question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disconnecting and not reconnecting

See original GitHub issue

I’m getting that error in all of sudden while it’s working fine.

   2021-02-09T16:45:54.69+0300 [APP/PROC/WEB/0] ERR Caught exception: TypeError: Cannot read property 'guild' of undefined
   2021-02-09T16:45:54.69+0300 [APP/PROC/WEB/0] ERR TypeError: Cannot read property 'guild' of undefined
   2021-02-09T16:45:54.69+0300 [APP/PROC/WEB/0] ERR     at ChannelManager.remove (/home/vcap/deps/0/node_modules/discord.js/src/managers/ChannelManager.js:44:17)
   2021-02-09T16:45:54.69+0300 [APP/PROC/WEB/0] ERR     at GuildDeleteAction.client.actions.GuildDelete.handle (/home/vcap/deps/0/node_modules/discord.js-light/actions.js:126:15)
   2021-02-09T16:45:54.69+0300 [APP/PROC/WEB/0] ERR     at Object.PacketHandlers.GUILD_DELETE (/home/vcap/deps/0/node_modules/discord.js-light/handlers.js:106:47)
   2021-02-09T16:45:54.69+0300 [APP/PROC/WEB/0] ERR     at WebSocketManager.client.ws.handlePacket (/home/vcap/deps/0/node_modules/discord.js-light/actions.js:38:28)
   2021-02-09T16:45:54.69+0300 [APP/PROC/WEB/0] ERR     at WebSocketShard.onPacket (/home/vcap/deps/0/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
   2021-02-09T16:45:54.69+0300 [APP/PROC/WEB/0] ERR     at WebSocketShard.onMessage (/home/vcap/deps/0/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
   2021-02-09T16:45:54.69+0300 [APP/PROC/WEB/0] ERR     at WebSocket.onMessage (/home/vcap/deps/0/node_modules/ws/lib/event-target.js:132:16)
   2021-02-09T16:45:54.69+0300 [APP/PROC/WEB/0] ERR     at WebSocket.emit (node:events:378:20)
   2021-02-09T16:45:54.69+0300 [APP/PROC/WEB/0] ERR     at Receiver.receiverOnMessage (/home/vcap/deps/0/node_modules/ws/lib/websocket.js:825:20)
   2021-02-09T16:45:54.69+0300 [APP/PROC/WEB/0] ERR     at Receiver.emit (node:events:378:20)
   2021-02-09T16:45:54.69+0300 [APP/PROC/WEB/0] ERR     at Receiver.dataMessage (/home/vcap/deps/0/node_modules/ws/lib/receiver.js:428:14)
   2021-02-09T16:45:54.69+0300 [APP/PROC/WEB/0] ERR     at Receiver.getData (/home/vcap/deps/0/node_modules/ws/lib/receiver.js:367:17)
   2021-02-09T16:45:54.69+0300 [APP/PROC/WEB/0] ERR     at Receiver.startLoop (/home/vcap/deps/0/node_modules/ws/lib/receiver.js:143:22)
   2021-02-09T16:45:54.69+0300 [APP/PROC/WEB/0] ERR     at Receiver._write (/home/vcap/deps/0/node_modules/ws/lib/receiver.js:78:10)
   2021-02-09T16:45:54.69+0300 [APP/PROC/WEB/0] ERR     at writeOrBuffer (node:internal/streams/writable:400:12)
   2021-02-09T16:45:54.69+0300 [APP/PROC/WEB/0] ERR     at _write (node:internal/streams/writable:341:10)
   2021-02-09T16:46:53.80+0300 [APP/PROC/WEB/0] OUT Debug log: [WS => Shard 0] [HeartbeatTimer] Didn't receive a heartbeat ack last time, assuming
zombie connection. Destroying and reconnecting.
   2021-02-09T16:46:53.80+0300 [APP/PROC/WEB/0] OUT     Status          : READY
   2021-02-09T16:46:53.80+0300 [APP/PROC/WEB/0] OUT     Sequence        : 66582
   2021-02-09T16:46:53.80+0300 [APP/PROC/WEB/0] OUT     Connection State: OPEN
   2021-02-09T16:46:53.80+0300 [APP/PROC/WEB/0] OUT Debug log: [WS => Shard 0] [DESTROY]
   2021-02-09T16:46:53.80+0300 [APP/PROC/WEB/0] OUT     Close Code    : 4009
   2021-02-09T16:46:53.80+0300 [APP/PROC/WEB/0] OUT     Reset         : true
   2021-02-09T16:46:53.80+0300 [APP/PROC/WEB/0] OUT     Emit DESTROYED: true
   2021-02-09T16:46:53.80+0300 [APP/PROC/WEB/0] OUT Debug log: [WS => Shard 0] Clearing the heartbeat interval.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
timotejroikocommented, Feb 9, 2021

This happens if client.channels and guild.channels go out of sync, which should never happen by itself, but can happen if the user manually removes a channel from one but forgets to remove it from the other.

discord.js master has a fix for this, but they did not backport it to v12, i guess i can backport it myself later today

0reactions
AykutSaraccommented, Feb 10, 2021

released the fix in v3.5.3, can you test?

Thanks, I’ve updated now. I will edit the post tomorrow with the result.

EDIT: I didn’t get any error seems to be fixed, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix a USB Device That Keeps Disconnecting ...
1. Quick Fixes for the "USB Keeps Disconnecting and Reconnecting" Error · Reboot your PC immediately when you encounter this issue. · Plug...
Read more >
5 Reasons Why Your Internet Keeps Disconnecting—and ...
Your randomly disconnecting internet could indeed be caused by outages from your ISP. The easiest way to find out is simply calling your...
Read more >
[SOLVED] USB Keeps Disconnecting and Reconnecting ...
USB keeps disconnecting and reconnecting issue is really annoying especially when you need to use the USB port immediately.
Read more >
[SOLVED] Internet Randomly Disconnects - Why and How to Fix
There are multiple reasons why your Internet connection randomly disconnects. When it comes to connecting to the Internet via WiFi, here are ...
Read more >
Wifi disconnects and doesn't automatically reconnect
Open Settings. Click on Network & Internet. Click on Status. Under the "Change your network settings" section, click the Network reset option.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found