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

8 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:

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

3 Replies

Railway
BOT

8 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!


8 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 8 months ago


8 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

6 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


Welcome!

Sign in to your Railway account to join the conversation.

Loading...