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
- 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!node version is latest stable update (v 18.17)
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 requestsgiven 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
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 responsestwo processes handling the same command
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?
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
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
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
Does your node version appear more than once?
yes ;;
i don't know where the code is looping <:hy_stressedd:686506166939025417>
or what's causing it to etc
Are you requiring your shard manager in any other files?
no
then just curious, why are you exporting
getConnection
from the file your ShardingManager
is in?