[FIXED] Healthcheck "service unavailable" on all new deploys, app returns 200
azkron
PROOP

8 days ago

All new deployments fail healthcheck with "service unavailable" even though the application responds HTTP 200 to /health internally.

Project Id 2ae19fcf-7945-41f2-a1a1-b3c92e9eae1d

Symptoms:

  • App starts, listens on 0.0.0.0:3000, responds 200 to /health (visible in deploy logs)

  • Railway's healthcheck prober simultaneously reports "service unavailable" for every attempt

  • Retries exhaust the full window and deploy fails

Deploy logs (truncated):
Starting Healthcheck
Path: /health
Retry window: 1m40s
Attempt #1 failed with service unavailable. Continuing to retry for 1m29s
Attempt #2 failed with service unavailable. Continuing to retry for 1m27s
timestamp=… level=INFO message="Listening on http://0.0.0.0:3000"
timestamp=… message="Sent HTTP response" http.status=200 http.method=GET http.url=/health
timestamp=… message="Sent HTTP response" http.status=200 http.method=GET http.url=/health
Attempt #3 failed with service unavailable. Continuing to retry for 1m25s
Attempt #4 failed with service unavailable. Continuing to retry for 1m21s

Deploy failed

For info I created a support post 12h ago but I have still received no answer and my service is down https://station.railway.com/questions/healthcheck-service-unavailable-on-all-857b7178

Solved

5 Replies

Do you have the PORT environment variable set to 3000?


azkron
PROOP

8 days ago

Yes

image.png

Attachments


azkron
PROOP

8 days ago

And the Build Logs /health checks timing correlates the /health answers from the Deploy logs. So something seems to be blocking the answers between the instance and the build container

image.png
image.png


azkron
PROOP

8 days ago

Found the issue, my CORS middleware was crashing on requests with no Origin header. When you use a specific allowlist (not *), the origin matcher function receives undefined for same-origin or server-to-server requests and throws. Adding a null check before matching fixed it.


azkron
PROOP

8 days ago

[FIXED] Healthcheck "service unavailable" on all new deploys, app returns 200


Status changed to Solved brody 8 days ago


Loading...