502 “Application failed to respond” on Node/Express app despite correct setup
piggyride-sahal
FREEOP

10 months ago

I’m experiencing persistent 502 “Application failed to respond” errors on my deployed Node/Express API, even though everything works locally and I’ve followed all best practices. Here’s a summary of my setup and what I’ve tried:

  • Repo: My GitHub repo is just the service folder (parent-api), not a monorepo root.

  • No root directory set in Railway (repo root is service root).

  • No Dockerfile, .dockerignore, or .nixpacks.toml in the repo.

  • package.json scripts:

  • "build": "prisma generate && tsc"

  • "start": "node dist/index.js"

  • App listens on:

0.0.0.0:${process.env.PORT} (I see “Parent API running on http://0.0.0.0:8080” in logs)

  • No custom build/start commands in Railway.

  • No custom PORT env variable set in Railway.

  • Build logs show tsc runs and dist/index.js is created.

  • App works locally with the Railway Postgres DB (can sign up, see users in DB).

  • On Railway:

  • App starts, logs “running”, but all requests (including /health) return 502.

  • No request logs appear in the app.

  • No crash or error is shown in the logs.

  • Tried deploying a minimal Express app (just /health route), still get 502.

What I need:

  • Help diagnosing why Railway’s proxy cannot reach my app, despite it running and listening on the correct port/host.

  • Any platform-specific issues or settings I should check.

Thank you for your help!

Solved$10 Bounty

Pinned Solution

10 months ago

Hey, can you please check if the target port is configured correctly? Documentation regarding this can be found at https://docs.railway.com/reference/errors/application-failed-to-respond#application-not-listening-on-the-correct-host-or-port.

1 Replies

chandrika
EMPLOYEE

10 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open chandrika 10 months ago


10 months ago

Hey, can you please check if the target port is configured correctly? Documentation regarding this can be found at https://docs.railway.com/reference/errors/application-failed-to-respond#application-not-listening-on-the-correct-host-or-port.


Status changed to Solved chandrika 10 months ago


Loading...