13 days ago
Two services in one project, same repo (apps/api), same Docker image,
same start command. One works, one never becomes healthy.
Start command:
npx prisma migrate deploy && echo '>>> STARTING NODE' && node dist/main.js; echo ">>> EXITED code=$?"
The Prisma output appears in the deploy logs. Neither echo ever does —
including the second one, which runs unconditionally via ";". The command
is visibly applied in Settings > Deploy > Custom Start Command.
The failing service then produces zero application output. It's a NestJS
app that normally logs ~500 lines at boot. Healthcheck retries the full
window and the deploy fails with "1/1 replicas never became healthy".
Deploy log, in full:
Starting Container
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "railway" ...
31 migrations found in prisma/migrations
No pending migrations to apply.
npm notice ...
That's the entire log. Nothing after.
The sibling service — same image, same start command, but no healthcheck
and no public domain — boots fully and logs everything normally.
The app also starts fine locally using the failing service's exact
variable set, and answers /api/v1/health with 200.
Already tried:
- Detached the volume (was mounted at /data) — no change
- Changed UPLOAD_DIR to a container-owned path — no change
- Set PORT explicitly to 3000 (it was not in Railway's injected vars) — no change
- Verified all env vars are present
- Build succeeds; image builds clean
Questions:
-
Why would echo produce no output when prisma in the same command does?
-
Is stdout lost when a container is terminated for a failed healthcheck?
-
healthcheckPath is set in railway.toml but Settings > Healthcheck Path
displays as unset — is config-as-code applying it?
Pinned Solution
13 days ago
Wrap you start command in a shell
sh -c "npx prisma migrate deploy && echo '>>> STARTING NODE' && node dist/main.js; echo \">>> EXITED code=$?\""
2 Replies
13 days ago
This thread has been opened as a bounty so the community can help solve it.
Status changed to Open Railway • 13 days ago
13 days ago
Wrap you start command in a shell
sh -c "npx prisma migrate deploy && echo '>>> STARTING NODE' && node dist/main.js; echo \">>> EXITED code=$?\""
13 days ago
I would also recommend move your prisma migrate deploy to Pre-deploy command
Pre-deploy command: npx prisma migrate deploy
Start command: node dist/main.js
Status changed to Solved jubzski • 13 days ago
