Closed MattIPv4 closed 2 years ago
Possibly related to #3560
Getting this once every week or two, is causing me problems.
Getting this once every week or two, is causing me problems.
Same for me, bumping but not having any updates.
Having the same problem on a ~101k guild bot, getting IPbanned as a result of this.
Causing consistent problems for a bot that I commonly use.
I am being affected as well.
This issue greatly affects a bot present in well over 100k servers. Fixing the issue should be a priority.
Still affected by this, the bot has well over 100k guilds.
This issue affecting the small bots too like 50 servers
This issue is actually affecting my serverโs own dedicated bot too which is only in the two servers (main and management).
This issue is affecting my bot which is in 2 servers
Package Current
discord.js 12.0.2
erlpack 0.1.3
zlib-sync 0.1.6
invited in 2 discord guilds
Hi, I just had this problem, my heroku dyno restarted and my bot was unavailable for one hour (at this point i manually restarted and it connected without problem). discord.js.log
429 hit on route /gateway/bot loop every 15 seconds after "Preparing to connect to the gateway..."
I've updated discord.js and i'll see if it happens again
I'd like to clarify and ask a few things about this issue, if possible ๐
We do have backoffs for login ratelimits, /gateway/bot
goes through the same API route/ratelimit parsing like everything else. This error you're encountering is highly likely to happen if you attempt to login with multiple shards in parallel. This shouldn't be affected by internal sharding however.
I've also been simply unable to replicate this with curl, and with discord.js as a whole. Most I've gotten was 1 429 at boot due to me reconnecting too soon (the ratelimit right now is 2/5
[2 every 5 seconds])
So.. how can we replicate this issue? What's your system? Are you sharding, if so how? What are some steps you can take that causes this to happen every time you take them? This information is going to help us a lot in debugging, and either fixing it on our side, or possibly guiding you into fixing it on your side ๐
So, I haven't had this happened in a while, but I think this actually comes from being IP banned from the API for a while (so, you could probably reproduce this by hammering the API for a short while until you get tempbanned). When the happens and you try to connect, you'll get a 429 on /gateway/bot. The debug logs from the library when this happens are very consistent in timing, so it doesn't feel like any backoff is happening.
As for my specific setup, using ShardingManager to handle shard spawning. This was happening when a single shard restarted, and would then just sit being ratelimited seemingly forever.
I think this actually comes from being IP banned from the API for a while
@MattIPv4 could this be related to https://github.com/discordjs/discord.js/issues/3560#issuecomment-692330833? (the API ban possibly coming from Cloudflare, which returns in seconds but we don't handle that yet)? It would kinda make sense if so, and it's probably highly related if so...
Yes! I saw your comment on that in Discord last night but wasn't auth'ed into GitHub. I think these two are probably intertwined, as this would be a Cloudflare ban, where Retry-After actually follows the spec and is in seconds.
One thing to note though, is that I'm still not convinced this is going through the exact same ratelimiting logic, as the ratelimit event doesn't get fired for this (#3891).
Wrong, it IS going through the same ratelimit logic, HOWEVER...
As you can see, on 429's we wait our the retryAfter. The check for emitting the rateLimit
event,
checks that this.limited
is truthy. limited
returns true under these conditions:
Notice the Date.now() < this.reset
. We already waited the supposed retryAfter, so Date.now() > this.reset
.. this is because, as mentioned in https://github.com/discordjs/discord.js/issues/3560#issuecomment-692330833 we don't handle Cloudflare bans yet
This won't be a problem once we move to API v8, as everything is according to the spec, and uses seconds (or..shouldn't be anymore) ๐
@MattIPv4 is this still an issue you encounter with newer releases?
๐ I haven't been in a situation where Discord has banned my token in a long time, but given d.js now uses v10 (I think) I imagine this has resolved itself
Then I'll be closing this ๐. Follow up if you encounter this again ๐
Please describe the problem you are having in as much detail as possible:
Well, I got one of my bots ratelimited on /gateway/bot it seems. Watching the debug event, it seems to be continually returning 429s on /gateway/bot whilst trying to log in.
It seems to be getting these at a very consistent rate, which would suggest to me the login method has no logic to consider a ratelimited response and back-off etc.?
Include a reproducible code sample here, if possible:
Logs from a slightly more fleshed out bot script:
Further details: