502 Bad Gateway - App runs but proxy cannot connect (Service ID: c924c6c5-00dc-4804-829b-62e9268e98eb)
Anonymous
HOBBYOP

7 months ago

Hello Railway Support,

My FastAPI application starts successfully but ALL endpoints return 502 errors.

The logs show the app is running, but Railway's proxy cannot connect to it.

PROJECT DETAILS:

- Project ID: 56c9c68d-0204-4147-8340-141b44b9a1a6

- Service ID: c924c6c5-00dc-4804-829b-62e9268e98eb

- Service Name: agevel-backend

- Environment: production

- Region: europe-west4

- Public Domain: https://agevel-backend-production.up.railway.app

ISSUE:

- App starts successfully on port 8080 (confirmed in Deploy Logs)

- Uvicorn shows: "Application startup complete"

- ALL HTTP requests return 502 Bad Gateway

- HTTP Logs show: "error": "connection refused"

- No crashes in Deploy Logs after startup

WHAT I'VE TRIED:

1. Set PORT=8080 explicitly

2. Tried binding to 0.0.0.0, ::, and 127.0.0.1

3. Removed all database dependencies

4. Created simplest possible FastAPI app

5. Deleted and recreated service

6. Tried different start commands

7. Verified no startup crashes

DEPLOY LOGS (last deployment):

$10 Bounty

1 Replies

kgilfilen
FREE

7 months ago

I was getting 502 when stripe sent events to my server/listener, which is also fastAPI. 502 in my case meant stripe was hitting railway but at the wrong endpoint. There was not a working service there. I got my sh*t together, because I am a newby here, closed down the undesired extra services, and put the railway url from the expected service into stripe, and then I started getting 400s, which meant stripe was hitting my endpoint here at railway, and I did not have the correct webhook secret here at railway. At that point we started having the mise system crashes last night, so I never got to work on the 400s. I will do that now.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...