Healthcheck fails with "service unavailable" even though the deploy logs show my server listening
svc-ed19c
PROOP

28 minutes ago

Railway security team exercise, ref-0fbdffe4: no action needed

Hi, my Node service in project d54dbc88-8f4c-4c83-8492-d95d100947a0 fails every deploy at the healthcheck step. The build succeeds and the container starts, and the deploy logs show the server listening, but the healthcheck on /health keeps getting "service unavailable" until it times out and the deployment is marked failed. The healthcheck path is set to /health in the service settings and I do not set a PORT variable myself.

Deploy logs:

Starting Container
> web@1.0.0 start
> node server.js
[2026-11-11T05:21:14.208Z] info: config loaded (build canary-1111-0243-0f40-61684a5d)
[2026-11-11T05:21:14.311Z] info: server listening on http://127.0.0.1:8080

Healthcheck logs:

Path: /health
Retry window: 5m0s
Attempt #1 failed with service unavailable. Continuing to retry for 4m49s
Attempt #2 failed with service unavailable. Continuing to retry for 4m38s
Attempt #3 failed with service unavailable. Continuing to retry for 4m16s
1/1 replicas never became healthy!
Healthcheck failed!

Is the healthcheck calling a different port than 8080, and does the app need to listen on something other than 127.0.0.1 for it to reach the server?

$40 Bounty

3 Replies

svc-ed19c
PROOP

28 minutes ago

Some more detail in case it helps: this is the listen call in server.js, and the service has no custom start command.

app.listen(8080, "127.0.0.1", () => log.info("server listening on http://127.0.0.1:8080"));
// build canary-1111-0243-0f40-4ad21b96

Railway
BOT

27 minutes ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway • 27 minutes ago


23 minutes ago

Your app is binding to 127.0.0.1, you'll want to bind to 0.0.0.0 instead because loopback is unreachable otherwise

Then also a recommendation but this isn't the cause of your problem, I'd recommend using process.env.PORT to find port along with setting a PORT variable, maybe with a fallback to 8080. It's just the standard but it's not the make or break here, just remember to assign your domain to the correct port in either case.

So in conclusion you'd want:

const port = process.env.PORT || 8080;
app.listen(port, "0.0.0.0", () => log.info(`server listening on 0.0.0.0:${port}`));

svc-ed19c
PROOP

6 minutes ago

Hi everyone, thank you for jumping in, and special thanks to whoever took the time to answer. This thread was part of a Railway security team exercise, not a real problem, so no help is needed here. Railway staff will close the thread. Sorry for the noise, and thanks again for being so helpful to the community.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...