Backend image fails on startup: Cannot find module 'uuid' #7

Closed
opened 2026-10-15 11:05:21 +00:00 by Golden-dreamer · 1 comment
Golden-dreamer commented 2026-10-15 11:05:21 +00:00 (Migrated from github.com)

The published image ghcr.io/backmeupplz/todorant-backend:latest starts, but the
Koa app fails to load, so no API routes are registered. <TODORANT_API>/docs/
returns "not found" and the web app can't sign in or create an account.

The module uuid is simply not present in the image's node_modules.

Steps to reproduce

Quick check, no compose needed:

docker pull ghcr.io/backmeupplz/todorant-backend:latest
docker run --rm --entrypoint sh ghcr.io/backmeupplz/todorant-backend:latest -c 'ls -d /app/node_modules/uuid'

Result:

ls: cannot access '/app/node_modules/uuid': No such file or directory

Full reproduction, following docs/self-hosting.md:

  1. Download docker-compose.yml and .env.example from main, set JWT to a random value
  2. docker compose up -d
  3. docker compose logs backend

Actual log

backend-1  | Telegram error reports disabled (errors go to the log): set TELEGRAM_ERROR_SENDER_TOKEN and CHAT_ID
backend-1  | Telegram bot disabled: set TELEGRAM_LOGIN_TOKEN
backend-1  | HTTP is listening on 1337
backend-1  | Sockets are listening on 3000
backend-1  | Koa app starting error:  Error: Cannot find module 'uuid'
backend-1  | Require stack:
backend-1  | - /app/dist/controllers/login.js
backend-1  | - /app/node_modules/koa-ts-controllers/dist/util/importClasses.js
backend-1  | - /app/node_modules/koa-ts-controllers/dist/index.js
backend-1  | - /app/dist/app.js
backend-1  | - /app/dist/server.js
backend-1  |     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1028:15)
backend-1  |     at Function.Module._resolveFilename (/app/node_modules/module-alias/index.js:49:29)
backend-1  |     at Function.Module._load (node:internal/modules/cjs/loader:873:27)
backend-1  |     at Module.require (node:internal/modules/cjs/loader:1100:19)
backend-1  |     at require (node:internal/modules/cjs/helpers:119:18)
backend-1  |     at Object.<anonymous> (/app/dist/controllers/login.js:30:16)
backend-1  |     at Module._compile (node:internal/modules/cjs/loader:1198:14)
backend-1  |     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
backend-1  |     at Module.load (node:internal/modules/cjs/loader:1076:32)
backend-1  |     at Function.Module._load (node:internal/modules/cjs/loader:911:12)
backend-1  |     at Module.require (node:internal/modules/cjs/loader:1100:19)
backend-1  |     at require (node:internal/modules/cjs/helpers:119:18)
backend-1  |     at /app/node_modules/koa-ts-controllers/dist/util/importClasses.js:37:16
backend-1  |     at Array.map (<anonymous>)
backend-1  |     at Object.importClassesFromDirectories (/app/node_modules/koa-ts-controllers/dist/util/importClasses.js:35:10)
backend-1  |     at Object.exports.bootstrapControllers (/app/node_modules/koa-ts-controllers/dist/index.js:68:29) {
backend-1  |   code: 'MODULE_NOT_FOUND',
backend-1  |   requireStack: [
backend-1  |     '/app/dist/controllers/login.js',
backend-1  |     '/app/node_modules/koa-ts-controllers/dist/util/importClasses.js',
backend-1  |     '/app/node_modules/koa-ts-controllers/dist/index.js',
backend-1  |     '/app/dist/app.js',
backend-1  |     '/app/dist/server.js'
backend-1  |   ]
backend-1  | }
backend-1  | Mongo connected
backend-1  | Indexes ready

Expected

No "Koa app starting error". <TODORANT_API>/docs/ shows the API docs and
sign-up works.

Environment

  • Image digest: ghcr.io/backmeupplz/todorant-backend@sha256:29ad33c21855d6a14ec9900a746362b6a56359609ab45ddf6f471222fdb10596
  • Pulled on 2026-10-15
  • Reproduced on:
    • Debian VPS: 11.11, x86_64, Docker version 29.7.2, build a7dcaa6
    • macOS: arm64, Docker version 29.2.1 (module check only)

Workaround

A derived image that copies the module in makes the backend start. The version
(8.3.2) is my guess; I don't know which one the code expects.

FROM ghcr.io/backmeupplz/todorant-backend:latest
RUN mkdir /tmp/u && cd /tmp/u && npm init -y >/dev/null \
 && npm install uuid@8.3.2 \
 && cp -r node_modules/uuid /app/node_modules/uuid \
 && rm -rf /tmp/u

I haven't checked the cause, but it looks like uuid is missing from
dependencies in backend/package.json or is removed in the production build
stage.

The published image `ghcr.io/backmeupplz/todorant-backend:latest` starts, but the Koa app fails to load, so no API routes are registered. `<TODORANT_API>/docs/` returns "not found" and the web app can't sign in or create an account. The module `uuid` is simply not present in the image's `node_modules`. ## Steps to reproduce Quick check, no compose needed: docker pull ghcr.io/backmeupplz/todorant-backend:latest docker run --rm --entrypoint sh ghcr.io/backmeupplz/todorant-backend:latest -c 'ls -d /app/node_modules/uuid' Result: ls: cannot access '/app/node_modules/uuid': No such file or directory Full reproduction, following docs/self-hosting.md: 1. Download `docker-compose.yml` and `.env.example` from `main`, set `JWT` to a random value 2. `docker compose up -d` 3. `docker compose logs backend` ## Actual log ``` backend-1 | Telegram error reports disabled (errors go to the log): set TELEGRAM_ERROR_SENDER_TOKEN and CHAT_ID backend-1 | Telegram bot disabled: set TELEGRAM_LOGIN_TOKEN backend-1 | HTTP is listening on 1337 backend-1 | Sockets are listening on 3000 backend-1 | Koa app starting error: Error: Cannot find module 'uuid' backend-1 | Require stack: backend-1 | - /app/dist/controllers/login.js backend-1 | - /app/node_modules/koa-ts-controllers/dist/util/importClasses.js backend-1 | - /app/node_modules/koa-ts-controllers/dist/index.js backend-1 | - /app/dist/app.js backend-1 | - /app/dist/server.js backend-1 | at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1028:15) backend-1 | at Function.Module._resolveFilename (/app/node_modules/module-alias/index.js:49:29) backend-1 | at Function.Module._load (node:internal/modules/cjs/loader:873:27) backend-1 | at Module.require (node:internal/modules/cjs/loader:1100:19) backend-1 | at require (node:internal/modules/cjs/helpers:119:18) backend-1 | at Object.<anonymous> (/app/dist/controllers/login.js:30:16) backend-1 | at Module._compile (node:internal/modules/cjs/loader:1198:14) backend-1 | at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10) backend-1 | at Module.load (node:internal/modules/cjs/loader:1076:32) backend-1 | at Function.Module._load (node:internal/modules/cjs/loader:911:12) backend-1 | at Module.require (node:internal/modules/cjs/loader:1100:19) backend-1 | at require (node:internal/modules/cjs/helpers:119:18) backend-1 | at /app/node_modules/koa-ts-controllers/dist/util/importClasses.js:37:16 backend-1 | at Array.map (<anonymous>) backend-1 | at Object.importClassesFromDirectories (/app/node_modules/koa-ts-controllers/dist/util/importClasses.js:35:10) backend-1 | at Object.exports.bootstrapControllers (/app/node_modules/koa-ts-controllers/dist/index.js:68:29) { backend-1 | code: 'MODULE_NOT_FOUND', backend-1 | requireStack: [ backend-1 | '/app/dist/controllers/login.js', backend-1 | '/app/node_modules/koa-ts-controllers/dist/util/importClasses.js', backend-1 | '/app/node_modules/koa-ts-controllers/dist/index.js', backend-1 | '/app/dist/app.js', backend-1 | '/app/dist/server.js' backend-1 | ] backend-1 | } backend-1 | Mongo connected backend-1 | Indexes ready ``` ## Expected No "Koa app starting error". `<TODORANT_API>/docs/` shows the API docs and sign-up works. ## Environment - Image digest: `ghcr.io/backmeupplz/todorant-backend@sha256:29ad33c21855d6a14ec9900a746362b6a56359609ab45ddf6f471222fdb10596` - Pulled on 2026-10-15 - Reproduced on: - Debian VPS: 11.11, x86_64, Docker version 29.7.2, build a7dcaa6 - macOS: arm64, Docker version 29.2.1 (module check only) ## Workaround A derived image that copies the module in makes the backend start. The version (8.3.2) is my guess; I don't know which one the code expects. FROM ghcr.io/backmeupplz/todorant-backend:latest RUN mkdir /tmp/u && cd /tmp/u && npm init -y >/dev/null \ && npm install uuid@8.3.2 \ && cp -r node_modules/uuid /app/node_modules/uuid \ && rm -rf /tmp/u I haven't checked the cause, but it looks like `uuid` is missing from `dependencies` in `backend/package.json` or is removed in the production build stage.
backmeupplz commented 2026-10-22 17:34:46 +00:00 (Migrated from github.com)

Thank you for such a thorough report! The digest check, full logs and workaround made this very easy to confirm.

You were right about the cause. Removing googleapis in #4 also removed the only production package that pulled in uuid, so the --production image no longer had it. This was fixed in #8 the same day: uuid is now a direct dependency, and the backend now crashes on a bootstrap error instead of starting without any routes. Your image (sha256:29ad33c2…, built 2026-10-14 from 99589d7) came out just before that fix.

I've just verified both ghcr.io/backmeupplz/todorant-backend:latest and :v2.2.6 (amd64 and arm64): node_modules/uuid is present, there's no "Koa app starting error", /docs/ returns 200, and sign-up works. Pulling again and dropping the derived image should be all you need:

docker compose pull && docker compose up -d

If anything else breaks, please open another issue.

Thank you for such a thorough report! The digest check, full logs and workaround made this very easy to confirm. You were right about the cause. Removing `googleapis` in #4 also removed the only production package that pulled in `uuid`, so the `--production` image no longer had it. This was fixed in #8 the same day: `uuid` is now a direct dependency, and the backend now crashes on a bootstrap error instead of starting without any routes. Your image (`sha256:29ad33c2…`, built 2026-10-14 from 99589d7) came out just before that fix. I've just verified both `ghcr.io/backmeupplz/todorant-backend:latest` and `:v2.2.6` (amd64 and arm64): `node_modules/uuid` is present, there's no "Koa app starting error", `/docs/` returns 200, and sign-up works. Pulling again and dropping the derived image should be all you need: docker compose pull && docker compose up -d If anything else breaks, please open another issue.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
backmeupplz/todorant#7
No description provided.