Flask App Deployment Completes But Service Never Starts - "Train Has Not Arrived

Anonymous
HOBBY

6 days ago

Hi Railway community,

I'm experiencing an issue where my Flask application deployment appears to complete successfully, but the service never actually starts running. Looking for help troubleshooting this.

## **Issue Summary**

- Flask app uploads successfully via `railway up`

- Deployment process completes without errors

- Domain is generated and accessible

- But visiting the domain shows "The train has not arrived at the station" (404)

- `railway logs` returns "No deployments found"

## **Technical Details**

**Framework:** Flask (Python)

**Dependencies:** Flask, Flask-CORS, yfinance, pandas, numpy, requests

**Entry Point:** Standard Flask app with `app.run(host='0.0.0.0', port=port)`

**Procfile:** `web: python app.py`

## **Project Structure**

```

project/

├── app.py # Main Flask application

├── requirements.txt # Dependencies

├── Procfile # Railway deployment config

└── src/

└── main.py # Copy of app.py

```

## **What I've Tried**

1. Multiple deployment attempts with `railway up`

2. Verified all files are present and correct

3. Confirmed app runs perfectly locally on port 5000

4. Checked that Procfile and requirements.txt are properly formatted

5. Tried both `app.py` and `src/main.py` as entry points

## **Expected vs Actual Behavior**

**Expected:** Domain serves the Flask application after successful upload

**Actual:** Domain returns 404 "The train has not arrived at the station"

## **CLI Output**

```bash

$ railway up

# Upload completes successfully with "Using Nixpacks"

$ railway logs

No deployments found

$ railway status

Project: [project-name]

Environment: production

Service: [service-name]

```

## **Questions**

1. Why would the upload succeed but the service never start?

2. How can I access build logs if `railway logs` shows no deployments?

3. Are there specific Flask configuration requirements I might be missing?

4. Could the heavy dependencies (pandas, numpy) be causing build timeouts?

The app works perfectly locally, so I'm confident the code is correct. Any insights into what might be preventing the service from starting would be greatly appreciated!

Thanks for any help!

$10 Bounty

5 Replies

windspore
FREE

6 days ago

This usually happens when Railway can’t detect the web service running on the correct port. Make sure you’re using this in your app:

port = int(os.environ.get('PORT', 5000))

app.run(host='0.0.0.0', port=port)

If the port isn’t set like this, Railway won’t know the service is up.

Also double check that you’re deploying from the folder where app.py and Procfile are both at the root. If you’re inside /src by mistake, Railway won’t find the entry point.

When logs say “No deployments found,” it normally means the service never started or it crashed before Railway could attach logs. You can try running it inside a Railway shell with:

railway run python app.py

If it works there, it should work when deployed.

The heavy dependencies like pandas and numpy won’t block the service from starting, they just slow down the build a bit.

It’s most likely just the port issue.


i would create a Dockerfile and add all the dependencies along with the commands you need to build the project.

at the end of the Dockerfile add

expose the, define the entrypoint and start Procfile

clearly this is for a rails project but the idea is the same although you would probably need

pip install honcho

and replace the bundle exec foreman with honcho

EXPOSE 5000
ENTRYPOINT ["/rails/bin/docker-entrypoint"]

CMD ["bundle", "exec", "foreman", "start", "-f", "Procfile"]

this will check if there any pending migrations and run them so will need to adjust it to your project

#!/bin/bash -e

echo "prepare db"
# If running the rails server then create or migrate existing database
if [ "$1" == "bundle" ] && [ "$2" == "exec" ] && [ "$3" == "foreman" ] && [ "$4" == "start" ]; then
  ./bin/rails db:prepare
  echo "prepared db"
fi

exec "${@}"

good luck


windspore

This usually happens when Railway can’t detect the web service running on the correct port. Make sure you’re using this in your app:port = int(os.environ.get('PORT', 5000))app.run(host='0.0.0.0', port=port)If the port isn’t set like this, Railway won’t know the service is up.Also double check that you’re deploying from the folder where app.py and Procfile are both at the root. If you’re inside /src by mistake, Railway won’t find the entry point.When logs say “No deployments found,” it normally means the service never started or it crashed before Railway could attach logs. You can try running it inside a Railway shell with:railway run python app.pyIf it works there, it should work when deployed.The heavy dependencies like pandas and numpy won’t block the service from starting, they just slow down the build a bit.It’s most likely just the port issue.

Anonymous
HOBBY

5 days ago

.


i got an email saying that you fixed it by manually installing the dependencies but you probably deleted the comment

one thing to keep in mind is that the next time you deploy you will need to install the dependencies again

due to the ephemeral nature of the environments on railway

you could try adding the `pip install -r requirements.txt` in the Custom build command under the service settings

if you found my answers helpful feel free to mark this thread as Solved


.

windspore
FREE

5 days ago

Hey, just checking in, is your issue solved now? If yes, it would be great to mark this as solved so others can find it easily. Let me know if you still need any help!