【发布时间】:2021-01-11 12:54:49
【问题描述】:
我使用 python 创建了一个简单的discord bot 并将其部署在 Heroku 免费实例上。
所以每当我在 Heroku 中部署机器人,然后将机器人添加到新服务器中并发送一条消息时,它都会回复一段时间,然后自动下线。
为了解决这个问题,我在连接到 Heroku 数据库的机器上部署了机器人,它在这里工作正常,机器人没有离线。
我是这个不和谐机器人和 Heroku 的新手,不知道为什么会发生这种情况。
我关注this solution 仍然没有解决,因为部署消息说它已成功部署但机器人离线。 谢谢
日志
2020-09-25T07:57:02.239139+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-09-25T07:57:02.257368+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-09-25T07:57:02.339933+00:00 heroku[web.1]: Process exited with status 137
2020-09-25T07:57:02.378370+00:00 heroku[web.1]: State changed from starting to crashed
2020-09-25T07:57:02.380707+00:00 heroku[web.1]: State changed from crashed to starting
2020-09-25T07:57:06.444215+00:00 heroku[web.1]: Starting process with command `python app.py`
2020-09-25T07:57:11.482276+00:00 app[web.1]: Logged on as prashant_bot#9323!
2020-09-25T07:57:41.039923+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=still-sierra-90196.herokuapp.com request_id=27691bf0-ab4e-49c2-8b37-39a87a64c3bd fwd="103.79.97.235" dyno= connect= service= status=503 bytes= protocol=https
2020-09-25T07:58:06.676326+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-09-25T07:58:06.694541+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-09-25T07:58:06.786955+00:00 heroku[web.1]: Process exited with status 137
2020-09-25T07:58:06.817777+00:00 heroku[web.1]: State changed from starting to crashed
2020-09-25T07:58:09.050473+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=still-sierra-90196.herokuapp.com request_id=5ae96361-aa32-4c5c-a53e-f8b213cc3afa fwd="103.79.97.235" dyno= connect= service= status=503 bytes= protocol=https
【问题讨论】:
-
发布 heroku 日志。您的
Procfile将您的heroku 进程定义为web进程。您可能遇到的错误是未能绑定到 $PORT。将web更改为除此之外的任何内容,例如worker或bot. -
@TinNguyen,我添加了将网络更改为工作人员的日志,但它仍然崩溃
-
日志显示您仍在以
web的身份执行它。该错误还说明了我假设Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch -
@TinNguyen 抱歉,我已经向您展示了之前构建的日志。
标签: python heroku discord.py