Search code examples
pythonherokucrashdyno

Heroku app crashing immediately after deployment


I am running a single clock dyno for my app but it crashes immediately after successful build.
Error message -

Build succeeded
heroku[clock.1]: State changed from up to crashed
heroku[clock.1]: State changed from crashed to starting
heroku[clock.1]: Starting process with command `python3 clock.py`
heroku[clock.1]: State changed from starting to up
heroku[clock.1]: Process exited with status 0
heroku[clock.1]: State changed from up to crashed

The error is then repeated all over again.

clock.py-

from apscheduler.schedulers.blocking import BlockingScheduler   
sched = BlockingScheduler(timezone="UTC")
def job_1(): 
    print("Reached Here") 
sched.add_job(job_1,trigger='interval', seconds=150)

Procfile -

clock: python3 clock.py

Solution

  • Forgot to include sched.start()