-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
Description
Which package is this bug report for?
ws
Issue description
If you receive an unexpected response such a 520 while the bot is booting up and before it reaches the ready event, client.destroy() is called which doesn't allow the bot to reach the ready event and needs to be manually rebooted. The expected resolution would be that it would be retried in these cases and the client wouldn't be destroyed.
2024-07-19 06:52:53 [error]: Shard with the ID of 20 encountered an error: Error: Unexpected server response: 520
at ClientRequest.<anonymous> (/home/app/node_modules/ws/lib/websocket.js:913:7)
at ClientRequest.emit (node:events:519:28)
at HTTPParser.parserOnIncomingClient (node:_http_client:698:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
at TLSSocket.socketOnData (node:_http_client:540:22)
at TLSSocket.emit (node:events:519:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:191:23)
2024-07-19 06:52:53 [info]: [WS => Shard 20] The gateway closed with an unexpected code 1006, attempting to resume.
2024-07-19 06:52:53 [info]: [WS => Shard 20] Destroying shard
Reason: none
Code: 1006
Recover: Resume
2024-07-19 06:52:53 [info]: [WS => Shard 20] Connection status during destroy
Needs closing: false
Ready state: 3
2024-07-19 06:52:53 [info]: [WS => Shard 20] Tried to destroy a shard that was idle
2024-07-19 06:52:53 [info]: [WS => Manager] Manager was destroyed:
at WebSocketManager.destroy (/home/app/node_modules/discord.js/src/client/websocket/WebSocketManager.js:327:30)
at Client.destroy (/home/app/node_modules/discord.js/src/client/Client.js:253:19)
at Client.login (/home/app/node_modules/discord.js/src/client/Client.js:231:18)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-07-19 06:52:53 [info]: [WS => Shard 0] Destroying shard
Reason: Manager was destroyed
Code: 1000
Recover: none
2024-07-19 06:52:53 [info]: [WS => Shard 1] Destroying shard
Reason: Manager was destroyed
Code sample
No response
Versions
Discord.js 14.15.3
Node LTS
Issue priority
Medium (should be fixed soon)
Which partials do you have configured?
Channel, GuildMember, Message, Reaction
Which gateway intents are you subscribing to?
Guilds, GuildMembers, GuildVoiceStates, GuildMessages, GuildMessageReactions
I have tested this issue on a development release
yes
Tristan-GPT