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

3 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. white_check_mark emoji Set PORT=8080 explicitly

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

3. white_check_mark emoji Removed all database dependencies

4. white_check_mark emoji Created simplest possible FastAPI app

5. white_check_mark emoji Deleted and recreated service

6. white_check_mark emoji Tried different start commands

7. white_check_mark emoji Verified no startup crashes

DEPLOY LOGS (last deployment):

$10 Bounty

1 Replies

kgilfilen
FREE

3 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.


Loading...