bot spawning multiple instances of the same shard and rate limiting

:NOOO: never had this issue so pardon my idiocy but bot spawns more than one instance and then i get an unhandledprmiserejection that after logging i found to be a 429 too many requests which i believe is due to the multiple instances logging in. if i use a command, i get discord API err that there's an unknown interaction. if u can help i will kiss u thx (/j)
15 Replies
d.js toolkit
d.js toolkit17mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
jamie
jamieOP17mo ago
node version is latest stable update (v 18.17)
duck
duck17mo ago
if it's the fact that everything is logging twice that makes you think more than one instance is spawned, you should take note of the fact that you listen to the debug event twice I only see 1 shard spawned
i get an unhandledprmiserejection that after logging i found to be a 429 too many requests
given that you haven't set anything to reject on rate limit, I'm unsure whether this is even from the discord api consider actually showing the error
if i use a command, i get discord API err that there's an unknown interaction
d.js docs
d.js docs17mo ago
Common causes of DiscordAPIError[10062]: Unknown interaction: - Initial response took more than 3 seconds ➞ defer the response *. - Wrong interaction object inside a collector. - Two processes handling the same command (the first consumes the interaction, so it won't be valid for the other instance) * Note: you cannot defer modal or autocomplete value responses
jamie
jamieOP17mo ago
two processes handling the same command
duck
duck17mo ago
two processes handling the same command is not the only cause of "Unknown interaction" how have you determined that this in particular is the case?
jamie
jamieOP17mo ago
response took literally less than a second to spawn + no issue w collectors as i use interactionCreate event, don’t use msg intent, no buttons, etc
duck
duck17mo ago
I don't see why that means you have two processes handling the same command you only have as many logs as you would for 1 process, so unless you have another terminal open with your bot running, I'm far more inclined to believe you only have one process
jamie
jamieOP17mo ago
okay, then is the "launched shard 0" without a logout and logging in multiple times not multiple instances? removed the second debug listener, thank u for catching that /gen
SpecialSauce
SpecialSauce17mo ago
Does your node version appear more than once?
jamie
jamieOP17mo ago
yes ;; i don't know where the code is looping <:hy_stressedd:686506166939025417> or what's causing it to etc
SpecialSauce
SpecialSauce17mo ago
Are you requiring your shard manager in any other files?
jamie
jamieOP17mo ago
no SADGECLAP
duck
duck17mo ago
then just curious, why are you exporting getConnection from the file your ShardingManager is in?
Want results from more Discord servers?
Add your server