1

I deploy a bot in heroku but it give a erro

   2021-04-03T02:56:36.610385+00:00 app[web.1]: 2021-04-03 02:56:36,604 - apscheduler.scheduler - INFO - Scheduler started
    2021-04-03T02:56:37.316107+00:00 app[web.1]: 2021-04-03 02:56:37,315 - telegram.ext.updater - ERROR - Error while bootstrap set webhook: Bad webhook: webhook can be set up only on ports 80, 88, 443 or 8443
    2021-04-03T02:56:37.316196+00:00 app[web.1]: 2021-04-03 02:56:37,316 - telegram.ext.updater - ERROR - Failed bootstrap phase after 0 retries (Bad webhook: webhook can be set up only on ports 80, 88, 443 or 8443)
2021-04-03T02:47:04.325287+00:00 app[web.1]: 2021-04-03 02:47:04,317 - telegram.ext.updater - ERROR - unhandled exception in Bot:1718309867:updater

Well, i tryed all port 80, 88, 8443 but it give me the same erro again.

My hook and port code:

#change PORT TO HEROKU
PORT = int(os.environ.get('PORT', '8443'))

updater = Updater(SECRET_KEY, use_context=True)

 #hook to heroku
updater.start_webhook(listen="0.0.0.0",
                          port=PORT,
                          url_path=SECRET_KEY)
    updater.bot.set_webhook('https://myapp.herokuapp.com/' + SECRET_KEY)

PS: In localhost work very well

1 Answer 1

2

Given the date of this question, I assume that you're using PTB v13.4+. In that case, please see this channel post, i.e. change

updater.start_webhook(listen="0.0.0.0",
                          port=PORT,
                          url_path=SECRET_KEY)
    updater.bot.set_webhook('https://myapp.herokuapp.com/' + SECRET_KEY)

to

updater.start_webhook(listen="0.0.0.0",
                      port=PORT,
                      url_path=SECRET_KEY,
                      webhook_url='https://myapp.herokuapp.com/' + SECRET_KEY)
Sign up to request clarification or add additional context in comments.

1 Comment

that's right. I made a downgree in the requirement.txt to work. Now with this structure I can go back to the latest version. it worked very well Thank you very much

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.