Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Discord app error R10 when deploying with Heroku

I tried to deploy my discord bot made with Node.js to Heroku, the build is successful but the app crashes and throws an error:

Error R10 (Boot timeout)
Web process failed to bind to $PORT within 60 seconds of launch

My Procfile:

web: node app.js

package.json:

{
  "name": "bot",
  "version": "5.0",
  "description": "Discord Bot",
  "main": "app.js",
  "scripts": {
    "start": "node app.js"
  },
  "author": "me",
  "license": "MIT",
  "dependencies": {
    "discord.js": "^11.3.2",
    "ffmpeg-binaries": "^3.2.2-3",
  }
}

My app takes a few seconds to launch localy.

How can I fix this?

like image 500
Jack Neth Avatar asked Aug 23 '18 11:08

Jack Neth


People also ask

How do I use Discord with Heroku?

To create a Discord server: Select a channel within your newly created server where you want to receive notifications of Heroku app builds. Click the edit channel option and navigate to Integrations. Once on the integrations page, Click the Create Webhook button to create a new webhook.

Why does node js app crash with r10?

This error is often caused by a process being unable to reach an external resource, such as a database, or the application doing too much work, such as parsing and evaluating numerous, large code dependencies, during startup. The default boot timeout is 60 seconds.

What is application Error in Heroku?

"Application Error" or similar is always caused by your own application code. Routing errors will normally only surface themselves within the logs of your application. To track this kind of issue down you should look at your logs: $ heroku logs --tail --app your_app_name.

How do you deploy a Heroku Discord bot?

In order for Heroku to deploy your bot, you need a file called package. json that tells Heroku what dependencies to install to run your app. If you haven't created one already, you can run npm init in the root directory of your bot to have an interactive prompt-based setup of your package. json file.


1 Answers

That's caused by the fact that you're not building a website, but your dyno is set to web.
You can change your dyno type in your Procfile by replacing web with worker:

worker: node app.js

Make sure this new worker dyno is active by going to your Heroku app dashboard > your app > resources (you can use the pencil buttons to turn on/off dynos)

like image 196
Federico Grandi Avatar answered Sep 22 '22 01:09

Federico Grandi