【发布时间】:2021-04-03 03:10:14
【问题描述】:
我在 heroku 中部署了一个机器人,但它给出了一个错误
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
好吧,我尝试了所有端口 80、88、8443,但它又给了我同样的错误。
我的钩子和端口代码:
#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:在 localhost 中工作得很好
【问题讨论】:
标签: heroku telegram-bot python-telegram-bot