Error WebSocket was closed before the connection was established

Version: ^13.8.1 (I will try upgrading but I don't think this is the issue)
node:events:505
throw er; // Unhandled 'error' event
^

Error: WebSocket was closed before the connection was established
at WebSocket.close (/home/discord/Order Management/node_modules/ws/lib/websocket.js:285:14)
at WebSocketShard.destroy (/home/discord/Order Management/node_modules/discord.js/src/client/websocket/WebSocketShard.js:806:27)
at WebSocketShard.onClose (/home/discord/Order Management/node_modules/discord.js/src/client/websocket/WebSocketShard.js:370:12)
at WebSocket.onClose (/home/discord/Order Management/node_modules/ws/lib/event-target.js:210:18)
at WebSocket.emit (node:events:527:28)
at WebSocket.emitClose (/home/discord/Order Management/node_modules/ws/lib/websocket.js:258:10)
at Receiver.receiverOnFinish (/home/discord/Order Management/node_modules/ws/lib/websocket.js:1158:20)
at Receiver.emit (node:events:527:28)
at finish (node:internal/streams/writable:754:10)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on WebSocket instance at:
at emitErrorAndClose (/home/discord/Order Management/node_modules/ws/lib/websocket.js:993:13)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
node:events:505
throw er; // Unhandled 'error' event
^

Error: WebSocket was closed before the connection was established
at WebSocket.close (/home/discord/Order Management/node_modules/ws/lib/websocket.js:285:14)
at WebSocketShard.destroy (/home/discord/Order Management/node_modules/discord.js/src/client/websocket/WebSocketShard.js:806:27)
at WebSocketShard.onClose (/home/discord/Order Management/node_modules/discord.js/src/client/websocket/WebSocketShard.js:370:12)
at WebSocket.onClose (/home/discord/Order Management/node_modules/ws/lib/event-target.js:210:18)
at WebSocket.emit (node:events:527:28)
at WebSocket.emitClose (/home/discord/Order Management/node_modules/ws/lib/websocket.js:258:10)
at Receiver.receiverOnFinish (/home/discord/Order Management/node_modules/ws/lib/websocket.js:1158:20)
at Receiver.emit (node:events:527:28)
at finish (node:internal/streams/writable:754:10)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on WebSocket instance at:
at emitErrorAndClose (/home/discord/Order Management/node_modules/ws/lib/websocket.js:993:13)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
2 Replies
d.js docs
d.js docs3y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Maxi130
Maxi130OP3y ago
└── [email protected] v16.16.0 No interaction with the bot has been made since start up. And it didn't crash directly after startup but a few hours later.
Want results from more Discord servers?
Add your server