Discord.js constantly reconnects due to helloTimeout

repro resource:
bot_repro.zip (1.0 KB)

run set botToken "token" in console, then start resource and observe server console

Discord.js running on fxserver will constantly attempt to reconnect due to

[WS => Shard 0] Did not receive HELLO in time. Destroying and connecting again.

eventually causing discord to reset the bot token due to logging in too often.

full log of the reconnect:

[    script:bot_repro] [WS => Shard 0] [CONNECT]
[    script:bot_repro]     Gateway    : wss://gateway.discord.gg/
[    script:bot_repro]     Version    : 9
[    script:bot_repro]     Encoding   : json
[    script:bot_repro]     Compression: none
[    script:bot_repro] [WS => Shard 0] Setting a HELLO timeout for 20s.
[    script:bot_repro] [WS => Shard 0] [CONNECTED] Took 182ms
[    script:bot_repro] [WS => Shard 0] Clearing the HELLO timeout.
[    script:bot_repro] [WS => Shard 0] Setting a heartbeat interval for 41250ms.
[    script:bot_repro] [WS => Shard 0] [IDENTIFY] Shard 0/1 with intents: 1
[    script:bot_repro] [WS => Shard 0] [READY] Session b30d71147cf3c31320445107975efedc.
[    script:bot_repro] [WS => Shard 0] [ReadyHeartbeat] Sending a heartbeat.
[    script:bot_repro] [WS => Shard 0] Shard received all its guilds. Marking as fully ready.
[    script:bot_repro] [WS => Shard 0] Heartbeat acknowledged, latency of 117ms.
[    script:bot_repro] [WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[    script:bot_repro] [WS => Shard 0] Heartbeat acknowledged, latency of 119ms.
[    script:bot_repro] [WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[    script:bot_repro] [WS => Shard 0] Heartbeat acknowledged, latency of 116ms.
[    script:bot_repro] [WS => Shard 0] Shard did not receive any more guild packets in 15000 ms.
[    script:bot_repro] Unavailable guild count: 0
[    script:bot_repro] [WS => Shard 0] Did not receive HELLO in time. Destroying and connecting again.
[    script:bot_repro] [WS => Shard 0] [DESTROY]
[    script:bot_repro]     Close Code    : 4009
[    script:bot_repro]     Reset         : true
[    script:bot_repro]     Emit DESTROYED: true
[    script:bot_repro] [WS => Shard 0] Clearing the heartbeat interval.
[    script:bot_repro] [WS => Shard 0] [CLOSE]
[    script:bot_repro]     Event Code: 4009
[    script:bot_repro]     Clean     : true
[    script:bot_repro]     Reason    :

this does not happen when running the bot from Node directly, @Dalrae also observed a similar issue a while back, he may be able to give more detailed information since when this occurs.

Test was done on FXServer-master SERVER v1.0.0.5371 win32

1 Like

apparently this has been fixed with discord.js a few months ago, however, no new release was made yet on their end.

havent had time to test yet

edit: built djs from source, that fixed it, great.

1 Like