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

arnetrice
PROOP

16 days 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:
App boots with Uvicorn successfully
Health check responds with 200 OK
Database connection initializes fine
Procfile and railway.json both define the web process
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: 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

2 Replies

Railway
BOT

16 days 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!


16 days 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 16 days ago


monuit
PROTop 10% Contributor

16 days 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


Loading...
App stops after startup – "Stopping Container" even though health check passes (sth-erp-v2) - Railway Help Station