Heroku Port issue
See original GitHub issueAfter deployment my bot with TelegramBots java sdk on heroku, app work fine, but after 90 second it’s crashed with log:
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
Heroku dynamically assigns your app a port, so you can’t set the port to a fixed number. Heroku adds the port to the env, so you can pull it from there. How i can switch listener like this (js telegram sdk):
.listen(process.env.PORT || 5000)
I can get port from env in java like System.getenv("PORT")
but can’t find where to put it in TelegramBots sdk.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Heroku + node.js error (Web process failed to bind to $PORT ...
I'm running a Discord bot on Heroku, and this threw me for a loop. Slack, Hipchat, etc. bots could likely have similar issues....
Read more >Troubleshooting Node.js Deploys - Heroku Dev Center
Heroku apps will not bind to just any port that your app is set up with. Apps should use the Node process to...
Read more >Heroku Help
What should I do if I'm locked out of my Heroku account? ... Select a topic, then pick a category and we'll show...
Read more >Problem in sending e-mails through SMTP - Heroku Help
My Heroku app sends e-mails to an external SMTP server at port 25 rather than using a Heroku add-on. It seems that the...
Read more >Runtime Principles | Heroku Dev Center
Each web process simply binds to a port, and listens for requests coming in on that port. The port to bind to is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@consoleassert As long as I understand, you can’t use webhook bots on heroku. A quote from https://core.telegram.org/bots/webhooks :
As you’ve said, heroku specifies the port for your app by itself.
So you have to use a longpolling bot.
Longpolling bot is not a WEB app on heroku, as it doesn’t listen to the incoming connections! It manually asks telegram servers wether they have a message for your bot.
So all you have to do is:
Hope this helps you!
@consoleassert Did @drunckoder solution work for you? If so, can you close the issue?