#App sleeping returns 502 Bad Gateway when the app is being resumed

36 messages · Page 1 of 1 (latest)

odd widget
#

After that error occurs, when I refresh the page again the app responds normally and there is nothing in logs. I have the new runtime enabled and the new proxy.

ionic summitBOT
#

Project ID: N/A

odd widget
#

N/A

#

I would expect it to wait for the container to start up again and then display the page instead of just responding with a bad gateway

#

while the container is still being started

hybrid condor
#

I assume that means the container did start but your app didn't respond in time

#

do you run migrations in your start command?

odd widget
hybrid condor
#

what kind of app is this?

odd widget
#

nextjs site

#

which is not connected to any database or anything

#

just a static website

hybrid condor
#

what's your start command?

odd widget
#

Before the app starts railway responds

#

did not change it

#

not using custom

#

so its most likely just npm run start

hybrid condor
#

are you using a health check

odd widget
#

i am not

hybrid condor
#

go ahead and implement that

odd widget
#

just putting a / will work?

hybrid condor
#

if it's a static site, yeah just the root path is fine

#

I can't remember if railway checks the health check when resuming a slept app, but it's good to have either way

odd widget
#

Before Starting Container appears in logs railway responds with a 502

#

i mean at the same time^

hybrid condor
#

okay, i asked the team about this and will get back to you when i have more information

odd widget
#

Thanks

hybrid condor
#

did you need an immediate solution? because i may have something you can try

odd widget
#

No

#

I will just disable app sleeping in the meantime Lol

hybrid condor
#

sounds good!

hybrid condor
#

got an answer back, this basically means your app was not able to answer the initial http request fast enough.

when there is an incoming request for a slept service, the sleeping service is started and is tcp probed every 30ms for a maximum of 10 seconds, once a prob is successful the http request gets sent to your app, if you app doesn't respond then you will see a railway error page

#

you have a few options -

  • figure out why your app accepts a tcp connection but not an http request and remedy that.
  • stick caddy in front of the service to retry connections on non-200 status code responses.
  • keep app sleeping disabled.
limpid jewelBOT
hybrid condor
#

We've resolved an issue where apps with longer startup times were showing 502 errors. Apps now have up to 10 seconds to start accepting traffic, thus preventing these error pages from appearing.

You will need to trigger a deployment so that the changes we have made take effect.