Search code examples
pythonherokutwitter

Python Twitter Bot w/ Heroku Error: R10 Boot Timeout


I have developed a simple python twitter bot which periodically executes various functions using the following libraries:

TwitterFollowBot==2.0.2
schedule==0.3.2

The application works fine when I execute it on my computer, and I wanted to migrate it to Heroku so it could run independently. Upon executing it on Heroku it works as it should for 60 seconds before timing out:

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

After researching this, I found out that Heroku dynamically switches ports and my application must continuously specify which port it should run on. From another thread I read that a possible solution required me to alter my Procfile, so I appended the PORT variable to the end:

Procfile: web: python app.py $PORT

This had no effect so I tried it again with ${PORT},
And I also tried switching web: with bot: (which stopped my application from executing properly)

I found other solutions to this issue which worked for node, or python applications using Django, Flask, etc... However, I was unable to find a solution for just a simple .py application. Is this even possible? Or should I create my app with Flask and attempt one of the other fixes?


Solution

  • If it doesn't provide any web content then you don't need to run a web process - call it something else like bot and then do:

    • heroku ps:scale web=0
    • heroku ps:scale bot=1

    and you won't get any more R10s.