简体   繁体   中英

Heroku worker dyno not showing up even though it is added in Procfile

I am trying to set up Heroku to host my Discord bot. I am sure that I have set up my Procfile correctly, but the worker dyno doesn't show up under Resources. Only the web dyno shows up and that doesn't work as it crashes with error R10 immediately after startup. Can someone help?

Procfile

worker: node index.js

package.json

{
  "name": "bot name",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "node index.js"
  },
  "author": "author",
  "license": "ISC",
  "dependencies": {
    "discord.js": "^12.2.0"
  }
}

Log

2020-07-28T17:03:18.000000+00:00 app[api]: Build started by user 
2020-07-28T17:03:42.000000+00:00 app[api]: Build succeeded
2020-07-28T16:58:24.618732+00:00 app[api]: Release v20 created by user
2020-07-28T16:58:24.897854+00:00 heroku[web.1]: State changed from crashed to starting
2020-07-28T16:58:27.754015+00:00 heroku[web.1]: Starting process with command `npm start`
2020-07-28T16:58:31.218171+00:00 app[web.1]: 
2020-07-28T16:58:31.218205+00:00 app[web.1]: > bot@0.9.0 start /app
2020-07-28T16:58:31.218206+00:00 app[web.1]: > node index.js
2020-07-28T16:58:31.218206+00:00 app[web.1]: 
2020-07-28T16:58:32.169174+00:00 app[web.1]: LOG> bot is now online!
2020-07-28T16:58:35.000000+00:00 app[api]: Build started by user 
2020-07-28T16:58:58.755714+00:00 heroku[web.1]: State changed from starting to down
2020-07-28T16:58:58.660155+00:00 app[api]: Deploy 643b70ba by user 
2020-07-28T16:58:58.660155+00:00 app[api]: Release v21 created by user 
2020-07-28T16:58:59.000000+00:00 app[api]: Build succeeded
2020-07-28T16:59:28.079035+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-07-28T16:59:28.102556+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-07-28T16:59:28.220163+00:00 heroku[web.1]: Process exited with status 137

资源选项卡下的 Dyno 列表

I deleted everything and set everything up again and it seems to work now. It's possible that it wasn't working because I didn't have the node_modules folder or because of some other error that happened in the first attempt of setting the bot up.

  1. Go to your heroku app
  2. Select Resources menu
  3. Turn on the "worker: node index.js" and turn off the "web npm start"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM