Heroku Discord Bot 离线 [英] Heroku Discord Bot is offline

查看:28
本文介绍了Heroku Discord Bot 离线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 heroku 上托管了一个不和谐的聊天机器人,但它突然下线了.我是在 Heroku 上托管的新手,所以我不太了解,但是,我尝试了一些简单的事情,比如再次部署一个分支(我连接到 github),但这是行不通的.

I'm hosting a discord chat bot on heroku, and suddenly it went offline. I am new to hosting on heroku, so i don't understand a lot, but, i tried simple things like deploying a branch again (im connected to github), and that wouldn't work.

这是日志:

在我点击打开应用之前:

Before i click open app:

2018-07-23T16:54:27.265702+00:00 app[worker.1]: 在 Function.Module._load (module.js:497:3)

2018-07-23T16:54:27.265702+00:00 app[worker.1]: at Function.Module._load (module.js:497:3)

2018-07-23T16:54:27.265704+00:00 app[worker.1]: 在 Function.Module.runMain (module.js:693:10)

2018-07-23T16:54:27.265704+00:00 app[worker.1]: at Function.Module.runMain (module.js:693:10)

2018-07-23T16:54:27.265705+00:00 app[worker.1]:启动时 (bootstrap_node.js:191:16)

2018-07-23T16:54:27.265705+00:00 app[worker.1]: at startup (bootstrap_node.js:191:16)

2018-07-23T16:54:27.265707+00:00 app[worker.1]: at bootstrap_node.js:612:3

2018-07-23T16:54:27.265707+00:00 app[worker.1]: at bootstrap_node.js:612:3

2018-07-23T16:54:27.327613+00:00 heroku[worker.1]:状态从最高变为崩溃

2018-07-23T16:54:27.327613+00:00 heroku[worker.1]: State changed from up to crashed

2018-07-23T16:54:27.310511+00:00 heroku[worker.1]:进程以状态 1 退出

2018-07-23T16:54:27.310511+00:00 heroku[worker.1]: Process exited with status 1

点击打开应用后:

2018-07-23T16:58:44.866697+00:00 heroku[router]: at=error code=H14 desc="No web processes running";方法=获取路径=/";host=cratefield.herokuapp.com request_id=b32a5f7d-157e-45a5-805b-8c306140d020 fwd=73.23.238.216"dyno=连接=服务=状态=503字节=协议=https

2018-07-23T16:58:44.866697+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=cratefield.herokuapp.com request_id=b32a5f7d-157e-45a5-805b-8c306140d020 fwd="73.23.238.216" dyno= connect= service= status=503 bytes= protocol=https

2018-07-23T16:58:45.502353+00:00 heroku[router]: at=error code=H14 desc="No web processes running";方法=获取路径=/favicon.ico"host=cratefield.herokuapp.com request_id=19e6fc48-37ed-48db-87f9-759d704ddb3e fwd=73.23.238.216"dyno=连接=服务=状态=503字节=协议=https

2018-07-23T16:58:45.502353+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=cratefield.herokuapp.com request_id=19e6fc48-37ed-48db-87f9-759d704ddb3e fwd="73.23.238.216" dyno= connect= service= status=503 bytes= protocol=https

2018-07-23T16:58:45.552383+00:00 heroku[router]: at=error code=H14 desc="No web processes running";方法=获取路径=/favicon.ico"host=cratefield.herokuapp.com request_id=bba2456f-50bc-4dbb-bee2-50b36a8caef5 fwd=73.23.238.216"dyno=连接=服务=状态=503字节=协议=https

2018-07-23T16:58:45.552383+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=cratefield.herokuapp.com request_id=bba2456f-50bc-4dbb-bee2-50b36a8caef5 fwd="73.23.238.216" dyno= connect= service= status=503 bytes= protocol=https

2018-07-23T17:01:47.069331+00:00 heroku[router]: at=error code=H14 desc="No web processes running";方法=获取路径=/";host=cratefield.herokuapp.com request_id=9a098d43-bc46-403a-9ed3-5b701cd720ac fwd=73.23.238.216"dyno=连接=服务=状态=503字节=协议=https

2018-07-23T17:01:47.069331+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=cratefield.herokuapp.com request_id=9a098d43-bc46-403a-9ed3-5b701cd720ac fwd="73.23.238.216" dyno= connect= service= status=503 bytes= protocol=https

推荐答案

发生这种情况是因为您使用的是 web dyno:如果应用程序不为网站提供服务,则该 dyno 会进入休眠状态超过 1 小时.
解决方案是从 web dyno 切换到 worker dyno:这种类型不服务于网站(如果您正在运行 Discord 机器人,则不需要它) 并且从不睡觉.

That happens because you're using a web dyno: a dyno that is put asleep if the application doesn't serve a website for more than 1 hour.
The solution is to switch from a web dyno to a worker dyno: this type does not serve websites (and if you're running a Discord bot you don't need it) and never goes to sleep.

进入你的 Procfile 文件 &将 web 替换为 worker,它应该是这样的:

Go in your Procfile file & replace web with worker, it should look like this:

worker: npm start //this is the command you use to start your app.

如果您愿意,可以查看 Heroku 关于睡眠应用的文章.

If you want you can take a look at the Heroku article about sleeping apps.

这篇关于Heroku Discord Bot 离线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆