Reputation:
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
Upvotes: 3
Views: 14344
Reputation: 41
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.
Upvotes: 4
Reputation: 6796
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.
Upvotes: 11
Reputation: 1861
The problem with your bot is that Heroku's free plan makes your application to sleep after 30 minutes of inactivity. The solution would be to select a paid plan to be sure that your bot remains active at all times.
Upvotes: 0