nestjs service starts retuning 502
78raoul78
HOBBYOP

a month ago

I have a front service and a back service deployed on railway, everything is working well, and suddenly, my front is getting 502 on options request without any change, and I dont see any spike related to resources.

and I think a fe seconds after a redeploy or a restart (or maybe its just a coincidence, it starts working again)

$10 Bounty

5 Replies

darseen
HOBBYTop 5% Contributor

a month ago

If your application takes a long time to start (connecting to a DB etc.) Railway might be routing traffic to it before it is actually ready to accept connections. You need to configure a Health Check Path in your service settings (/health). Railway will not route traffic (avoiding 502s) until that endpoint returns a 200 OK.


78raoul78
HOBBYOP

a month ago

The thing is, my application was already started and was successfully returning responses, then suddenly it started returning 502, and there was no event during this transition (I didn't touch to anything, and cpu memory limits were not at all reached)


darseen
HOBBYTop 5% Contributor

a month ago

Can you check if your application crashed during the time you started getting 502 errors? Providing error logs will be helpful as well.


78raoul78
HOBBYOP

a month ago

no error log :
- 502 started at 9:23

but on deploy logs, nothing special, at 9:23, the app just stopped printing any log, and at 9:31 I just restarted the service


darseen
HOBBYTop 5% Contributor

a month ago

Well, since the logs don't show any errors during that time, I don't really know what could be causing this. Maybe your app was OOM Killed, but you said there was no spike in memory usage, so it's not likely the case.


Loading...