discord.js: rateLimit event not fired for ratelimit received during login

Please describe the problem you are having in as much detail as possible:

Related to the issue I encountered in #3890, it seems that not only does the client not back off when it gets a ratelimited response during login, but it also doesn’t fire the documented rateLimit event.

Include a reproducible code sample here, if possible:

// This requires you be ratelimited
const client = new Client();
client.on('debug', (...args) => console.log('debug', ...args));
client.on('rateLimit', (...args) => console.log('rateLimit', ...args));
await client.login(token);
// Observe continual 'debug' logs
// Observe no 'rateLimit' logs

Logs from a slightly more fleshed out bot script:

 MNGR | 20/3/3 22:13:38  INFO  Launched shard 0
 S0 | 20/3/3 22:13:39  INFO  Logging in...
 S0 | 20/3/3 22:13:39  DEBUG  Provided token: [SNIP]
 S0 | 20/3/3 22:13:39  DEBUG  Preparing to connect to the gateway...
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
 S0 | 20/3/3 22:13:39  DEBUG  429 hit on route /gateway/bot
^C

Further details:

  • discord.js version: 12.0.1
  • Node.js version: 12.15.0
  • Operating system: Windows server 2016
  • Priority this issue should have – please be realistic and elaborate if possible: P2 - Less important than the client actually ignoring the ratelimits, but if you have a documented ratelimit event, it really should fire on ratelimits.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 15
  • Comments: 19 (7 by maintainers)

Most upvoted comments

Uninstall Discordjs then reinstall it.

That should work (I tried it and it worked)

How come the library is not considering cloudflare ratelimits?

I can verify this is true, debugged and got a 429 error on /gateway/bot

Ratelimited, no error, nothing.

Hello, can this issue take a real priority ? Been few months now and today I can not even start my bot without being ratelimited every single time.