DiscordJs ConnectionTimeoutError UND_ERR_CONNECT_TIMEOUT

93 Views Asked by At

So I have a discord bot on discordJs 14.9.0. When I run it on my PC, it runs fine. But as soon as I try to start it on my server, it gets this error:

ConnectTimeoutError: Connect Timeout Error
      at onConnectTimeout (/root/IRCHelfer/node_modules/@discordjs/rest/node_modules/undici/lib/core/connect.js:186:24)
      at /root/IRCHelfer/node_modules/@discordjs/rest/node_modules/undici/lib/core/connect.js:133:46
      at Immediate._onImmediate (/root/IRCHelfer/node_modules/@discordjs/rest/node_modules/undici/lib/core/connect.js:174:9)
      at process.processImmediate (node:internal/timers:478:21) {
      code: 'UND_ERR_CONNECT_TIMEOUT'
[Error from logs][1]

But other Bots on the same version are running fine. Does anyone have any idea what could be causing the error?

I already tried to update all npm and node stuff. I tried another version of undici (tbh i dont really know if i did that correctly) I tried to go back to the version that worked but i think the new npm version or whatever plays a part here.

And another thing I noticed was my package-lock.json got nearly twice as big since I updated npm and node. Is there way to delete all unnecessary packages/nodemodules other than npm prune because that didnt help.

0

There are 0 best solutions below