Deployment Auto-Start Issue - Build Succeeds but No Logs Until Manual Restart

ctbo3
FREE

14 days ago

I'm experiencing a deployment issue where my application builds successfully but doesn't auto-start after deployment. The app only starts after a manual restart through the Railway dashboard.

Issue Details:

  • Project ID:

  • Service: petite-shelf (production)

  • Framework: Python FastAPI application

  • Start Command:python app.py

Symptoms:

  1. Git push triggers build successfully (build logs show completion)

  2. Deployment shows "Active" but no deployment logs appear

  3. Message shows: "No deployment logs. All output sent to stdout will be displayed here"

  4. Manual restart through dashboard immediately fixes the issue

  5. App runs perfectly after manual restart

Timeline:

  • App deployed successfully for 20+ days

  • Issues started ~June 28-30 when we added:

    • Cron job configuration in railway.json

    • Historical data re-analysis features

  • No issues with local development

What We've Tried:

  1. Added print statements at top of app.py - work after manual restart

  2. Removed Procfile to avoid config conflicts

  3. Verified railway.json syntax

  4. Tested with minimal Python script - same behavior

  5. Checked for syntax errors - none found

  6. Build succeeds with all dependencies installed

Current railway.json:

{
  "build": {
    "builder": "NIXPACKS"
  },
  "deploy": {
    "startCommand": "python app.py",
    "restartPolicyType": "ON_FAILURE",
    "restartPolicyMaxRetries": 10
  },
  "cron": [
    {
      "name": "daily-analysis",
      "schedule": "30 10 * * 1-5",
      "command": "python trigger_analysis.py"
    }
  ]
}

Questions:

  1. Are there any known issues with cron jobs affecting deployment auto-start?

  2. Is there a race condition between the cron configuration and main app startup?

  3. Should we add a health check endpoint to help Railway determine readiness?

  4. Are there any recent platform changes that might affect Python app startup?

The app works perfectly once manually restarted, suggesting the code is fine but something in the deployment pipeline isn't triggering the initial start correctly.

Any guidance would be greatly appreciated.

Thank you

Solved$10 Bounty

5 Replies

ctbo3
FREE

14 days ago

can I undo the "solved" command? It was clicked accidentally?


ctbo3

can I undo the "solved" command? It was clicked accidentally?

smolpaw
HOBBYTop 5% Contributor

14 days ago

umm.. Isn't that obvious or am i not getting it ?
You added a cron schedule to have the app run once everyday from Monday to Friday at 10:30AM, so the app is going to start at 10:30AM
Why would you think it should start immediately ?


smolpaw

umm.. Isn't that obvious or am i not getting it ?You added a cron schedule to have the app run once everyday from Monday to Friday at 10:30AM, so the app is going to start at 10:30AMWhy would you think it should start immediately ?

ctbo3
FREE

14 days ago

I think you are saying that cron job is default to "ONLY" run at: (time). Am I following you? So any pushes are held up until that time. Is there a setting for "AND" run at: (time)? So jobs run at set time and manual deployments also run?


ctbo3

I think you are saying that cron job is default to "ONLY" run at: (time). Am I following you? So any pushes are held up until that time. Is there a setting for "AND" run at: (time)? So jobs run at set time and manual deployments also run?

smolpaw
HOBBYTop 5% Contributor

14 days ago

There is no such settings as far as I am aware. You have to achieve that behavior by creating 2 different apps, 1 with cron and 1 without both being deployed from your repo.
If some state needs to stay in sync between 2 applications then you will have to achieve that by using an external state management application like a db.


smolpaw

There is no such settings as far as I am aware. You have to achieve that behavior by creating 2 different apps, 1 with cron and 1 without both being deployed from your repo.If some state needs to stay in sync between 2 applications then you will have to achieve that by using an external state management application like a db.

ctbo3
FREE

14 days ago

Thanks. The issue is that Cron Jobs was intended to be applied to the app and not the entire service. I think I can fix it from here.


Status changed to Solved chandrika 14 days ago