Listen EADDRINUSE: address already in use :::3000


#1

I’ve tried all the other things for my bot to work with the dbl webhook but it keeps doing this over and over. I can’t access the event.js either and I don’t know how to fix it.

My project is the-keplerbot

Please help quick,


#2

Hello @keplerteddy, welcome to the support forum!

Let me take a look at your code. It sounds like you have more than one piece of code trying to listen to requests on the same port, which is the cause of the error.


#3

Taking a look at your project’s logs, I don’t see this error. When are you getting that message?


#4

I currently commented the stuff out, I’ll uncomment it again.


#5

Ah, I see the error now. If you comment out the code above that’s doing the ‘ping’, the error will go away. You may need to then figure out how to get DBL working at the same time as the ping server though.


#6

It also works if I change the port to 5000 as well…

But then it isn’t connected.
Here is a few pages on the webhooks: https://discordbots.org/api/docs#jslib
and: https://discordbots.org/api/docs#webhooks


#7

Any code running on glitch will need to listen to process.env.PORT. We only let that port get through.


#8

You may be able to use the arrangement here to do both at the same time: Page cant be found


#9

Hmm I don’t have an server at the moment, what would I set webhookServer to then?


#10

I’ve added the same code that he did, and it seems to still say the exact same thing :confused:


#11

you’re calling .listen on the server twice, you can remove one of those .listen calls (maybe the one on line 22)


#12

Am I missing process.env.PORT?


#13

Hmm, that seemed to work!


#14

Great! take a look around and see if things are working.


#15

Things are now working! I pressed the test button back at Discord Bot List and the test outputted like it was supposed too!

Thank you so much! :smiley: