Shards are Still being spawned + Sharding Ready died
Code is fine. Token is fine. Works with Staging but not on main (i know sorta a replica but other errors)
12 Replies
Preparing to connect to the gateway...
[WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 1
[WS => Manager] Session Limit Information
Total: 1000
Remaining: 341
[WS => Manager] Spawning shards: 0
[WS => Shard 0] [CONNECT]
Gateway : wss://gateway.discord.gg/
Version : 9
Encoding : json
Compression: none
[WS => Shard 0] Setting a HELLO timeout for 20s.
[WS => Shard 0] [CONNECTED] Took 238ms
[WS => Shard 0] Clearing the HELLO timeout.
[WS => Shard 0] Setting a heartbeat interval for 41250ms.
[WS => Shard 0] [IDENTIFY] Shard 0/2 with intents: 515
[WS => Shard 0] [READY] Session 5f736b66acd5fe1f916f99abf52d1515.
[WS => Shard 0] [ReadyHeartbeat] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 830ms.
node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^
Error [SHARDING_IN_PROCESS]: Shards are still being spawned.
at ShardingManager._performOnShards (F:\marzt\Documents\Dev\prns\node_modules\discord.js\src\sharding\ShardingManager.js:285:75)
at ShardingManager.fetchClientValues (F:\marzt\Documents\Dev\prns\node_modules\discord.js\src\sharding\ShardingManager.js:266:17)
at Shard._handleMessage (F:\marzt\Documents\Dev\prns\node_modules\discord.js\src\sharding\Shard.js:359:22)
at ChildProcess.emit (node:events:527:28)
at emit (node:internal/child_process:936:14)
at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
Node.js v18.2.0
F:\marzt\Documents\Dev\prns\node_modules\discord.js\src\sharding\Shard.js:161
reject(new Error('SHARDING_READY_DIED', this.id));
^
Error [SHARDING_READY_DIED]: Shard 0's process exited before its Client became ready.
at Shard.onDeath (F:\marzt\Documents\Dev\prns\node_modules\discord.js\src\sharding\Shard.js:161:16)
at Object.onceWrapper (node:events:642:26)
at Shard.emit (node:events:527:28)
at Shard._handleExit (F:\marzt\Documents\Dev\prns\node_modules\discord.js\src\sharding\Shard.js:407:10)
at ChildProcess.emit (node:events:527:28)
at ChildProcess._handle.onexit (node:internal/child_process:291:12) {
[Symbol(code)]: 'SHARDING_READYDIED'
}
_
The Staging Bot works more than fine
its just the main Bot
you are using client.shard.fetchClientValues() before every shard is spawned
likely because "Staging Bot" only has one shard
seems like it
Cuz the Presence sets as soon as one shard is running
Seems like that is not fixing it tho
i actually dont know how to
And it seems like its not a thing that the presence is doing
Its a Dynamic status thoe
Even with the code removed it does not work
Could i maybe let the bot wait that it does nothing at all until all shards are done loading?
Like is there a way to tell it to wait?
Now it takes too long to become ready
nvm
same error
everything that somehow calls fetchClientValues is removed
that makes literally no sense
both fetchClientValues and broadcastEval cannot be called until all shards have spawned
yea i know that. But i cannot find where it is called selswhere. So thats why i wanna have the bot just pause until everything is loaded up correctly
Its only in Files that are only called when for example guildCreate is triggered
In ready its been removed aka commented out
any event can be triggered before all other shards are spawned
e.g. if the first shard is ready, it can receive guildCreate events before the rest of the shards have spawned
Is there a way to check the Status of all shards? if yes i could theoretically put all events that just continue its stuff when every shard is ready
Okay now i may have a solutuion
but its always timing out
so no way to test it
Idk how todo that
okay i think i fixed it
but the Timeouts are getting on my nerves
Okay seems like i fixed it. thx for ur help
Do you remember how you fixed it?
It's been 2 years so not rly
And the bot has been recoded several times after that
Qjuh's acting like he's going on a rampage
Therefore, i have not been able to reach a solution for about 5 hours
Thanks for your reply anyway :)
I know, and i thank you for helping me even to that point, but i can honestly say that the help did not have much effect on my mistake. So i guess that's why you got angry and left
I saw in your old posts that you run the handler when all the shards are running and I did it this way. This fixed that bug but created another bug. Now when I use the commands I get "ConnectTimeoutError: Connect Timeout Error (attempted addresses: IP:443, IP:443, IP:443, IP:443, IP:443, IP:443)"
If i don't put the mongo connect function there, i get the mongo failed to connect error
I solved this problem
Only move connectMongo function in allShardsReady process and use setTimeout
first load mongo and wait 15 seconds