discord.js
discord.js copied to clipboard
`ws` throws `TypeError: Cannot use 'in' operator to search for 'code' in undefined` when with Deno
Which package is this bug report for?
ws
Issue description
- Use deno, Make a simple Discord bot.
- Leave the bot running for a long time. (Maybe 1 day?)
- The bot suddenly throws an error and dies.
Error : TypeError: Cannot use 'in' operator to search for 'code' in undefined
Location: https://github.com/discordjs/discord.js/blob/main/packages/ws/src/ws/WebSocketShard.ts#L794
If I manually modify the conditional statement locally as follows, the problem no longer occurs. But I'm not sure if it's okay to do this.
onError(error) {
if (error && "code" in error && ["ECONNRESET", "ECONNREFUSED"].includes(error.code)) {
I'm not sure if this is due to differences between Deno and Node.js, but I suspect it is.
Code sample
No response
Versions
- discord.js 14.15.3
- Deno 1.44.0
Issue priority
Low (slightly annoying)
Which partials do you have configured?
No Partials
Which gateway intents are you subscribing to?
Guilds, GuildMessages, MessageContent
I have tested this issue on a development release
No response