502 Bad Gateway error even when deployment was successful

thesephi
TRIAL

6 months ago

Hello, I got 502 error, even when the deployment job went well. Here are the details:

The same code (same commit) operates normally on local or VPS.

The only pointer is from Network Log:
```
requestId:"UjmMSnSGQnyBRX-80DPDbA_3243920489"

timestamp:"2025-02-27T03:44:36.768909623Z"

method:"GET"

path:"/"

host:"fullsoak.up.railway.app"

httpStatus:502

upstreamProto:"HTTP/1.1"

downstreamProto:"HTTP/2.0"

responseDetails:"failed to forward request to upstream: connection refused"

totalDuration:10549
```

Is there any way I could investigate further? Thanks in advance for your help!

Solved

3 Replies

6 months ago

Hello,

Please check out our docs on this topic -

https://docs.railway.com/reference/errors/application-failed-to-respond

Best,
Brody


Status changed to Awaiting User Response Railway 6 months ago


brody

Hello,Please check out our docs on this topic -https://docs.railway.com/reference/errors/application-failed-to-respondBest,Brody

thesephi
TRIAL

6 months ago

Hi @brody, thanks for your pointer

Tbh that was the 1st document I read, and I've exhausted all options in my previous rounds.

It's mentioned that we need to set host 0.0.0.0 explicitly. I use a library that isn't mentioned in the docs; and the lib says it defaults to 0.0.0.0: https://github.com/oakserver/oak/blob/baa38fa8a562fc197407e96be6ff396f760fd6f2/application.ts#L48-L50

But looks like it wasn't the case. When I explicitly force it to 0.0.0.0 then it does work.

So TL;DR: the hiccup was probably somewhere in the lib itself or its docs.

My appreciations for your msg above, thanks to which I was able to push through to the bottom!

Best regards,
Khang


Status changed to Awaiting Railway Response Railway 6 months ago


6 months ago

Awsome, I'm glad I could help in some way!


Status changed to Awaiting User Response Railway 6 months ago


Status changed to Solved brody 6 months ago