Kameq
Kameq2mo ago

Error while using discord.js with deno

Hi, I encountered a problem with my discord bot. It stops after many hours with such error:
/root/.pm2/logs/index-error.log last 15 lines:
11|index | Download https://jsr.io/@std/datetime/0.225.2/_date_time_formatter.ts
11|index | Download https://jsr.io/@std/dotenv/0.225.2/mod.ts
11|index | Download https://jsr.io/@std/dotenv/0.225.2/parse.ts
11|index | Download https://jsr.io/@std/dotenv/0.225.2/stringify.ts
11|index | error: Uncaught TypeError: Cannot use 'in' operator to search for 'code' in undefined
11|index | at WebSocketShard.onError (file:///root/.cache/deno/npm/registry.npmjs.org/@discordjs/ws/1.1.1/dist/index.js:1065:16)
11|index | at WebSocket.connection.onerror (file:///root/.cache/deno/npm/registry.npmjs.org/@discordjs/ws/1.1.1/dist/index.js:683:12)
11|index | at WebSocket.wrappedHandler (ext:deno_web/02_event.js:1400:12)
11|index | at innerInvokeEventListeners (ext:deno_web/02_event.js:757:7)
11|index | at invokeEventListeners (ext:deno_web/02_event.js:804:5)
11|index | at dispatch (ext:deno_web/02_event.js:661:9)
11|index | at WebSocket.dispatchEvent (ext:deno_web/02_event.js:1041:12)
11|index | at WebSocket.[[[eventLoop]]] (ext:deno_websocket/01_websocket.js:494:16)
11|index | at eventLoopTick (ext:core/01_core.js:175:7)
11|index | Watcher Process failed. Restarting on file change...
/root/.pm2/logs/index-error.log last 15 lines:
11|index | Download https://jsr.io/@std/datetime/0.225.2/_date_time_formatter.ts
11|index | Download https://jsr.io/@std/dotenv/0.225.2/mod.ts
11|index | Download https://jsr.io/@std/dotenv/0.225.2/parse.ts
11|index | Download https://jsr.io/@std/dotenv/0.225.2/stringify.ts
11|index | error: Uncaught TypeError: Cannot use 'in' operator to search for 'code' in undefined
11|index | at WebSocketShard.onError (file:///root/.cache/deno/npm/registry.npmjs.org/@discordjs/ws/1.1.1/dist/index.js:1065:16)
11|index | at WebSocket.connection.onerror (file:///root/.cache/deno/npm/registry.npmjs.org/@discordjs/ws/1.1.1/dist/index.js:683:12)
11|index | at WebSocket.wrappedHandler (ext:deno_web/02_event.js:1400:12)
11|index | at innerInvokeEventListeners (ext:deno_web/02_event.js:757:7)
11|index | at invokeEventListeners (ext:deno_web/02_event.js:804:5)
11|index | at dispatch (ext:deno_web/02_event.js:661:9)
11|index | at WebSocket.dispatchEvent (ext:deno_web/02_event.js:1041:12)
11|index | at WebSocket.[[[eventLoop]]] (ext:deno_websocket/01_websocket.js:494:16)
11|index | at eventLoopTick (ext:core/01_core.js:175:7)
11|index | Watcher Process failed. Restarting on file change...
My bot code does not seem to be invalid: https://github.com/kameqdev/game-server-status-bot Is it problem with deno, discord.js, some package used by discord.js or npm compatibility -# my deno version is 1.46.3 (stable, release, x86_64-unknown-linux-gnu); v8 12.9.202.5-rusty; typescript 5.5.2
1 Reply
Fryke
Fryke3w ago
I ran into the same issue and needed to switch to using @discordeno/bot instead