Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

node.js - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...