Serverless deployment returns 502 while waking
mordak
HOBBYOP

3 months ago

In the last couple of days I noticed that my serverless deployment is returning 502 while waking, whereas before it used to wait until the service was up and then pass the request through.

My service takes about 2-3 seconds to launch and initialize. Up to a few days ago this was no problem, and the request that initiated a wake up of the service would just wait until it was up and then return. As of a couple of days ago railway is returning 502 and an error message while the service is waking up, but then an immediate reload of the page works normally.

Is there a timer I can change to ensure that inbound requests wait long enough before returning 502?

Solved

14 Replies

Status changed to Awaiting Railway Response Railway 3 months ago


mordak
HOBBYOP

3 months ago

Looking at the HTTP logs from today, it seems the gateway gives up and returns 502 after 1 second, which is too short to allow the service to spin up?


mordak

Looking at the HTTP logs from today, it seems the gateway gives up and returns 502 after 1 second, which is too short to allow the service to spin up?

dijiflex
HOBBY

2 months ago

I am also having the same issue


Railway
BOT

2 months ago

Hello!

We've escalated your issue to our engineering team.

We aim to provide an update within 1 business day.

Please reply to this thread if you have any questions!

Status changed to Awaiting User Response Railway 2 months ago


sam-a
EMPLOYEE

2 months ago

Hey, thanks for the report. You're right that the gateway is giving up too quickly during serverless wake-up. We've identified a bug on our side and are tracking it internally. Your service isn't doing anything wrong here.

In the meantime, if you need to avoid the 502s, you can disable serverless sleep on the service as a workaround until we get this fixed. No other configuration changes needed on your end. We'll follow up once the fix is out.


vlad-solomon
HOBBY

2 months ago

I'm having the same issue. I've temporarily disabled serverless. I'm waiting for an update! Thank you <3


Status changed to Awaiting Railway Response Railway 2 months ago


2 months ago

We have released a fix. Please redeploy your services and let us know if you continue to see this.


Status changed to Awaiting User Response Railway 2 months ago


mordak
HOBBYOP

2 months ago

Unfortunately, I am still seeing this. I re-enabled Serverless and it redeployed. Then I waited a bit for it to go to sleep, and saw the same behaviour. I've copied a log entry below in case it helps!

{ "requestId": "ECDzrWiHQ-Ckx6AXn6XIxQ", "timestamp": "2026-03-12T01:00:34.496802267Z", "method": "GET", "path": "/", "host": "omitted", "httpStatus": 502, "upstreamProto": "", "downstreamProto": "HTTP/1.1", "responseDetails": "Retried single replica", "totalDuration": 1019, "upstreamAddress": "", "clientUa": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1", "upstreamRqDuration": 1018, "txBytes": 4682, "rxBytes": 648, "srcIp": "43.153.58.28", "edgeRegion": "us-west2", "upstreamErrors": "[{\"deploymentInstanceID\":\"5459da18-4bbd-46d1-849b-eb75823259e5\",\"error\":\"connection refused\",\"duration\":1015},{\"deploymentInstanceID\":\"5459da18-4bbd-46d1-849b-eb75823259e5\",\"error\":\"connection refused\",\"duration\":2},{\"deploymentInstanceID\":\"5459da18-4bbd-46d1-849b-eb75823259e5\",\"error\":\"connection refused\",\"duration\":1}]" }


Status changed to Awaiting Railway Response Railway 2 months ago


2 months ago

Thank you, we will continue to look into this.


Status changed to Awaiting User Response Railway 2 months ago


dijiflex
HOBBY

2 months ago

I am also still experiencing the issue


Status changed to Awaiting Railway Response Railway 2 months ago


Anonymous
PRO

2 months ago

Still!


2 months ago

We will continue to look into this.


Status changed to Awaiting User Response Railway 2 months ago


2 months ago

It should be fixed now. Please redeploy and let us know if you see this again.


brody

It should be fixed now. Please redeploy and let us know if you see this again.

dijiflex
HOBBY

2 months ago

I can confirm now it is working for me. Thank you


Status changed to Awaiting Railway Response Railway 2 months ago


chandrika
EMPLOYEE

2 months ago

Glad to hear the fix is working. If anyone else in this thread is still experiencing 502s during serverless wake-up after redeploying, please open a new thread and we'll take a look.


Status changed to Awaiting User Response Railway 2 months ago


Status changed to Solved chandrika 2 months ago


mordak
HOBBYOP

2 months ago

Fixed! Thank you! 🙂


Status changed to Awaiting Railway Response Railway 2 months ago


Status changed to Solved mordak 2 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...