Skip to content

TypeError: Cannot set properties of null (setting 'onmessage') #8980

Closed as not planned
@l1v0n1

Description

@l1v0n1

Which package is this bug report for?

discord.js

Issue description

Bot catch error

Code sample

[WS => Shard 1] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 1] Heartbeat acknowledged, latency of 163ms.
[WS => Shard 1] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 1] Heartbeat acknowledged, latency of 11087ms.
[WS => Shard 1] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 1] Heartbeat acknowledged, latency of 5203ms.
[WS => Shard 1] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 1] Heartbeat acknowledged, latency of 9131ms.
[WS => Shard 1] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 1] Heartbeat acknowledged, latency of 23495ms.
[WS => Shard 1] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 1] Heartbeat acknowledged, latency of 17746ms.
[WS => Shard 1] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 1] Heartbeat acknowledged, latency of 40558ms.
[WS => Shard 1] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 1] Heartbeat acknowledged, latency of 15899ms.
[WS => Shard 1] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 1] Heartbeat acknowledged, latency of 23288ms.
[WS => Shard 1] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 1] Heartbeat acknowledged, latency of 228ms.
[WS => Shard 1] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 1] Heartbeat acknowledged, latency of 179ms.
[WS => Shard 1] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 1] Tried to send packet '{"op":1,"d":1549}' but no WebSocket is available!
[WS => Shard 1] [DESTROY]
    Close Code    : 4000
    Reset         : false
    Emit DESTROYED: true
[WS => Shard 1] Clearing the heartbeat interval.
[WS => Shard 1] [WebSocket] Destroy: Attempting to close the WebSocket. | WS State: CLOSING
[WS => Shard 1] WS State: CLOSING
[WS => Shard 1] Shard was destroyed but no WebSocket connection was present! Reconnecting...
[WS => Shard 1] A connection object was found. Cleaning up before continuing.
    State: CLOSING
[WS => Shard 1] [DESTROY]
    Close Code    : 1000
    Reset         : false
    Emit DESTROYED: false
[WS => Shard 1] [WebSocket] Destroy: Attempting to close the WebSocket. | WS State: CLOSING
[WS => Shard 1] WS State: CLOSING
[WS => Shard 1] [WebSocket] Adding a WebSocket close timeout to ensure a correct WS reconnect.
        Timeout: 5000ms
[WS => Shard 1] [CONNECT]
    Gateway    : wss://gateway-us-east1-b.discord.gg
    Version    : 10
    Encoding   : json
    Compression: none
[WS => Shard 1] Setting a HELLO timeout for 20s.
[WS => Shard 1] [WebSocket] Clearing the close timeout.
[WS => Shard 1] [WebSocket] Close Emitted: false
[WS => Shard 1] [WebSocket] did not close properly, assuming a zombie connection.
Emitting close and reconnecting again.
C:\Users\Admin\Desktop\neurobalbes discord js\node_modules\discord.js\src\client\websocket\WebSocketShard.js:883
    this.connection.onopen = this.connection.onclose = this.connection.onmessage = null;
                                                                                 ^

TypeError: Cannot set properties of null (setting 'onmessage')
    at WebSocketShard._cleanupConnection (C:\Users\Admin\Desktop\neurobalbes discord js\node_modules\discord.js\src\client\websocket\WebSocketShard.js:883:82)
    at Timeout.<anonymous> (C:\Users\Admin\Desktop\neurobalbes discord js\node_modules\discord.js\src\client\websocket\WebSocketShard.js:606:12)
    at listOnTimeout (node:internal/timers:564:17)
    at process.processTimers (node:internal/timers:507:7)

Package version

dev [email protected]

Node.js version

v18.12.1

Operating system

Windows

Priority this issue should have

Medium (should be fixed soon)

Which partials do you have configured?

No Partials

Which gateway intents are you subscribing to?

Guilds, GuildMessages

I have tested this issue on a development release

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions