R
Railway5mo ago
.

502 Bad Request error occurring when waking up the service after App Sleep

In this case, the 502 Bad Request error occurs only when the service is waking up from App sleep. There's no cold start; it doesn't wait and immediately returns a 502 error. After about 2 to 5 seconds, refreshing the page resolves the issue, but this problem only happens during the application's wake-up process. The issue doesn't occur when the service is already awake. What could cause Railway to return a 502 when it should be just a cold start? I'm developing a project in Next.js with a custom server, as described in Railway's documentation, and it's being used under the Cloudflare Proxy. Is there a way to resolve this issue or at least increase Railway/Cloudflare's timeout to wait for the service to wake up? id: cf4394a0-0027-4329-a43a-0df88b77c287
8 Replies
Percy
Percy5mo ago
Project ID: cf4394a0-0027-4329-a43a-0df88b77c287
Brody
Brody5mo ago
this is a known issue, and its something they want to fix.
.
.OP5mo ago
I noticed that this doesn't happen with other services. I'm running a Python Flask service in the same project, and it wakes up from app sleep without any issues. It seems to be something specific to Node or something related to the custom server.
Brody
Brody5mo ago
not too sure what you mean by custom server
Brody
Brody5mo ago
curious as to why you need a custom server for railway specifically?
.
.OP5mo ago
This is the only way to run Socket.IO in a single service in the Next.js app router. Of course, it would be better to create a separate service, so I noticed this issue. But again, I'm not sure if this is the problem.
Brody
Brody5d ago
gotcha, but yeah this is an issue with railway, and they are aware 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. cc @Sam 🤍
Want results from more Discord servers?
Add your server