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
5 Replies
8 days ago
Do you have the PORT environment variable set to 3000?
Yes
Attachments
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.
Status changed to Solved brody • 8 days ago