-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting ratelimited #3560
Comments
Hello, kinda high issue, happening everyday since I updated the repo (was on a september commit) |
Is it possible you hit the max of 1000 logins per day? Have you tried listening on the debug event? |
Nope, when I am hitting 1k logins a day its different, I can't login for 24 hours and debugging tells how many time I have to wait, here I am getting a 429 "Too many requests" and debugging only shows this : |
If you need help with discord.js installation or usage, please go to the discord.js Discord server instead: https://discord.gg/bRCvFy9 Since this is happening at exactly 0:00 it would seem there's some scheduled task running at this time causing it. We can investigate further on Discord. |
Yeah but, as the line is saying "This should never happen" I guess this is related to the lib. |
i could imagine that this might be related to multiple Shards/Clients fetching the /bot/gateway endpoint at the same time and since they dont know of each other they do too many requests and hit the ratelimit, are you sure you dont fetch the /bot/gateway endpoint on your own? because d.js should only ever fetch that on startup and i can't imagine that your bot restarts everytime on 0:00 GMT |
I think too but I have no reason fetching this endpoint on my own. |
Okay i just looked in the src and saw that d.js actuall does call the /bot/gateway endpoint everytime it reconnects (this shouldn't be like that) and since you mentioned that you get these every day at 0:00 GMT this probaly means that your bot reconnects every day at that time (maybe related to your host?) sadly d.js does always fetch the session endpoint even when resuming a session but vlad actuall fixed that in #3393 so you could give this pr a try since it should fix your issue (he changed it so it only fetches /gateway/bot if no session_id id present). Also you should probaly check why the bot reconnects everytime at 00:00 GMT, do you maybe change your ip or does your isp/host do that? i would recommend looking into that. Even tho #3393 probaly fixes this issue i will open another one because the current implementation is very poor designed for bots using any ShardingManager and this needs to be changed since we currently do not handle ratelimits for /gateway/bot across shards. |
This is was I thought, I will give a try to this PR and check tonight if it is happening again and will update the issue. My bot is not reconnecting at 0:00 this is why I do not understand 😯 |
Are you sure about this? because it very much looks like it (reconnecting does not only include re-identifying but also resuming a session) can you make sure and listen to the |
Update : I started debugging tonight to see what happen at 0:00 GMT, I found what in my bot was getting me ratelimited for 1h. I was hitting 429 very very many times but with different enpoints, the most I saw was I havn't tried the PR because I got no time yesterday. Anyway, I'll keep this issue open until we get a fix on master. |
You are being very vague about this.
It would be nice if this is getting a bit more context. |
If you get ratelimited on other routes e.g |
Yes very sorry will explain better as soon as I can
Maybe hitting it too much result to a gateway ban for 1 hour (Can't connect for 1 hour everytime it happens) |
Hello, this is happening today but in different way, restarted my bot after making changes and now bot is having very difficulties to connect and I am hitting 429 way too much (I should never hit 429 remember) Could be a possible API issue (https://status.discordapp.com/) but still, I should not hit 429 |
Hello, it happened again tonight with discord increased API response time. Any news for this ? |
UP |
Having the same issue here now. Have 0 idea this has never happened before. very frustrating |
If it happens once or a few times and you're sharded across multiple processes, it happens. If it's spammed, it's an issue. d.js version, node.js version please! |
Discord.js ^12.2.0 It isnt spammed, just happens every minute or so. |
Discord.js v12 has a minimum Node version of v12 also. This doesn't line up |
it worked for 3 months originally? |
Even me bot the problem. But i was just connected like 10 times
Node Engine: 12.x |
My project is not working on Any Bot Tokens Pls help everybots getting strucked at Provided token: NzEwODE2MTI3MTA5OTU1NjA1.XsOUQw.***************************
Preparing to connect to the gateway...
429 hit on route /gateway/bot I Don't what I want to do. also I just logging one time in my project |
You are IP banned for 1 hour, just wait and retry. |
I'm pretty late here - I had found the cause lol. It was because of webhooks, which sent "logs" so fast and their rate limits were not handled.
It doesn't happen anymore.
I didn't change, but I had to multiply the retryAfter with 1000 for avoiding the additional spam. :/ |
That's most likely because the API ban comes from Cloudflare (or so I assume)... Hence why the multiply by 1000 worked; this is why I asked if you can log the |
Yes, the API ban is coming from Cloudflare, we also call it a CF ban. For my case, I will explain how it was happening: My bot was hitting the 50req/s limit set by Discord, this was causing a Global Ratelimit. The shard that was receiving the ratelimit was correclty handling it but other ones could not, this is how I was getting massive 429's (with 320 shards means a lot) because they were still sending request while being ratelimited. When this was happening it could solve itself after few seconds and was hitting around 300-400 429's but sometimes it was reaching the 10k limit in few seconds. The last few weeks, it was happening 1 time a day and sometimes 2. |
Sorry, but since I removed the webhook logs Rate limit didn't get hit since then, I assume its fixed now. It was a problem on my end. |
I can confirm that using webhooks to logs creates high rate of 429's. Im reaching around 100 ratelimits in past 10 minutes when I enable them. |
I got banned 2x this day thanks to this 429 at const body = await res.json();
this.manager.client.emit('debug', `429 hit on route ${request.route} | ${this.retryAfter} idk if this ms or seconds`);
await Util.delayFor(this.retryAfter * (body?.message?.includes("You are being blocked") ? 1000 : 1)); I've been down for a bit of time, around 4 hours already due to this issue. This issue could potentially prevent big bots from logging in 👀 |
I also got a rate limit and only discovered it via the debug eventemitter, it would be nice if the "ratelimit" event would really emit when 429 was given as a response |
My bot is down for hours at a time because of this issue, I'm running 7 shards and getting rate-limited almost immediately on boot. I don't understand why it suddenly started getting rate-limited a week ago, and again today, is this really on Discord's end? Also very unhelpful, ShardingManager appears to just throw an unhandledexception when this occurs, it does not display any sort of 429 error, which made this extremely confusing to debug... |
Is this still an issue? If so, what discord.js/node.js version? |
Recently just got the 429 error. I have no idea what caused it. It could be because of the webhooks for errors my bot uses, or maybe it was using the I'm going to try and restart the bot in about an hour to see if it goes away or not by then. Also going to listen to the rateLimit and probably the debug event to see what initially causes this to avoid this in the future. |
Closing this as it is a stale issue. Feel free to make a new issue if this problem still persists. |
Please describe the problem you are having in as much detail as possible:
I am getting ratelimited by discord for an unknown reason
As said here it should never happen but I do not know why this is happening for me
discord.js/src/rest/RequestHandler.js
Line 149 in 6be5051
For more information, it's happening frequently at 00:00 GMT
I am also having a lot of 500 errors when this is happening.
Include a reproducible code sample here, if possible:
Further details:
The text was updated successfully, but these errors were encountered: