App stops after startup – "Stopping Container" even though health check passes (sth-erp-v2)
arnetrice
PROOP

5 months ago

Hi Railway Team,

My FastAPI app (sth-erp-v2) starts successfully and returns 200 OK on the health check, but Railway keeps stopping the container a few seconds later. It appears to be misclassified as a job instead of a web service.

Here’s what I’ve confirmed:
white_check_mark emoji App boots with Uvicorn successfully
white_check_mark emoji Health check responds with 200 OK
white_check_mark emoji Database connection initializes fine
white_check_mark emojiProcfile and railway.json both define the web process
x emoji After startup, Railway immediately logs “Stopping Container” and shuts it down
Example logs:
INFO: Application startup complete.

INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)

INFO:core.database.db:white_check_mark emoji Database connection initialized successfully

INFO: 100.64.0.2:35931 - "GET / HTTP/1.1" 200 OK

INFO: Started server process [1]

Stopping Container

Procfile:
web: uvicorn main:app --host 0.0.0.0 --port $PORT
railway.json:
{

"build": { "builder": "NIXPACKS", "nixpacksPlan": { "phases": { "build": { "cmds": ["pip install -r requirements.txt"] } } } },

"start": "uvicorn main:app --host 0.0.0.0 --port $PORT"

}

Everything works correctly on local and responds fine before the platform stops it.
Could you please verify that the service is correctly classified as a web service and not a job or worker type on the backend?

$10 Bounty

3 Replies

Railway
BOT

5 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


5 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 5 months ago


5 months ago

hey, is there any reason youre using procfile & railway.json? you can just merge them into one app, or set your start command on your service to be uvicorn main:app --host 0.0.0.0 --port $PORT

iirc railway doesnt stop containers, its usually an app level issue


this-is-shreya
HOBBY

2 months ago

Hi,
I was facing a similar issue where it was shutting down my app, saying "Stopping container". I fixed it by using the port detected by railway instead of custom port here:

Attachments


Loading...