Service returning 502 despite app running cleanly on port 8080
remi
HOBBYOP

a month ago

My service is fully booting and binding to 0.0.0.0:8080 but all requests return 502 connection dial timeout from both the custom domain and the Railway-generated URL. Deploy logs show the app starts cleanly and completes initialization. The networking config shows port 8080. This has been happening all day. Been doing the run around checking everything, and I can't figure it out.

Solved$10 Bounty

5 Replies

Status changed to Open Railway about 1 month ago


richwardle
PRO

a month ago

502 dial timeout from BOTH the custom domain AND the .up.railway.app URL = railway's edge can't reach the container at all, regardless of routing. since you've confirmed binding to 0.0.0.0:8080 and target port is 8080, the gap is between "log line printed" and "socket actually accepting connections".

quickest split — railway shell into the service, then:

ss -tlnp | grep 8080
curl -v http://localhost:8080/

three outcomes that narrow it cleanly:

  • ss shows :8080 LISTEN + local curl returns 200 → railway-side routing issue, tag @brody with project + service ids and these outputs as evidence
  • ss shows nothing on 8080 → the app crashed silently after the startup log; the listen call never actually completed (uncaught exception in a deferred init step, missing dep, panic in a goroutine that took the process down)
  • ss shows the listener but local curl hangs → bound but not accepting; init thread is blocked (deadlock, sync DB call, healthcheck thread holding the event loop)

once you know which branch you're in the fix is clear. without that split it's guesswork.


remi
HOBBYOP

a month ago

Hi Rich- I can't actually shell into the service. I'm just on the Hobby plan and I'm new to all this. Everything looks clean as far as I can tell. Should I delete the service from my git repo and re-add it and my env vars? Start from scratch?


remi
HOBBYOP

a month ago

Okay I re-added the Git Repo, re-set my env vars, a new domain with proper 8080 ports, and re-ran deployment. Network Flow Logs show only UDP and UNKNOWN protocol traffic — zero TCP connections are being routed to the container despite the app binding to 0.0.0.0:8080 and the target port being set to 8080. The proxy appears to not be routing TCP traffic to this deployment instance at all.

 REM-Goner 26168560 Canyhe copy.png

Attachments


richwardle

502 dial timeout from BOTH the custom domain AND the `.up.railway.app` URL = railway's edge can't reach the container at all, regardless of routing. since you've confirmed binding to 0.0.0.0:8080 and target port is 8080, the gap is between "log line printed" and "socket actually accepting connections". quickest split — `railway shell` into the service, then: ``` ss -tlnp | grep 8080 curl -v http://localhost:8080/ ``` three outcomes that narrow it cleanly: - `ss` shows `:8080 LISTEN` + local curl returns 200 → railway-side routing issue, tag @brody with project + service ids and these outputs as evidence - `ss` shows nothing on 8080 → the app crashed silently after the startup log; the listen call never actually completed (uncaught exception in a deferred init step, missing dep, panic in a goroutine that took the process down) - `ss` shows the listener but local curl hangs → bound but not accepting; init thread is blocked (deadlock, sync DB call, healthcheck thread holding the event loop) once you know which branch you're in the fix is clear. without that split it's guesswork.

remi
HOBBYOP

a month ago

Forgot to hit reply, but I think I found something. Look at the previous post I just added here.


remi
HOBBYOP

a month ago

I have found the issue. It was deep in my code causing failures after build.


Status changed to Solved remi about 1 month ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...