Discord.js: How to change port

Created on 13 Nov 2019  路  3Comments  路  Source: discordjs/discord.js

I am trying to deploy a discord bot on Heroku. And By default, Heroku binds the port itself, that's why we define like port = process.env.port || 80. So How can I edit that port in discordJS so Heroku can look for the port in env? This is the reason my Heroku app is crashing after 60 second
Screenshot from 2019-11-14 02-27-29

Most helpful comment

Discord.js does not expose any kind of port nor a http server.

All 3 comments

Discord.js does not expose any kind of port nor a http server.

Either way, you're using the web dyno. Go into the dynos panel of your Heroku project, disable the web dyno, and enable the worker dyno. That should work for you - if it doesn't, feel free to contact me on Discord at newt#1234, as this isn't really the place to discuss this.

I can confirm that the suggestion @newtykins made works for me. Make sure you have a file called "Procfile" (with no extention) that contains "worker: npm start" then restart your dynos, turn off the web dyno and turn on the worker one you just made.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tiritto picture tiritto  路  3Comments

Brawaru picture Brawaru  路  3Comments

Dmitry221060 picture Dmitry221060  路  3Comments

Acaretia picture Acaretia  路  3Comments

DatMayo picture DatMayo  路  3Comments