Heroku Discord Bot is offline
Solution 1
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.
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.
If you want you can take a look at the Heroku article about sleeping apps.
Solution 2
I know it's one year late but for those who are still having this issue, you have a limit of 550 hours per month (about 22 days) to host your bot with the free plan (paid plans get no run time limit)
This might be the problem, you can check your notifications on heroku to find out.
Related videos on Youtube
Peter Burns
Stack Overflow Valued Associate #00001 Wondering how our software development process works? Take a look! Find me on twitter, or read my blog. Don't say I didn't warn you because I totally did. However, I no longer work at Stack Exchange, Inc. I'll miss you all. Well, some of you, anyway. :)
Updated on June 04, 2022Comments
-
Peter Burns about 2 years
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.
Edit: Here is the log:
Before i click open app:
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]: at Function.Module.runMain (module.js:693:10)
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.327613+00:00 heroku[worker.1]: State changed from up to crashed
2018-07-23T16:54:27.310511+00:00 heroku[worker.1]: Process exited with status 1
After clicking Open App:
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" 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" 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" 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
-
Rodrigo MataAre you using heroku's free plan?
-
-
alpha_ulrich about 3 yearsWhile this is true, you can add a credit card to your account, to receive 450 extra free hours per month, resulting in being able to run 1 free dyno for the whole month.