Closed didinele closed 2 years ago
Not all routes have rate-limits. You are only bound to your global rate-limit if they don't. Looks like this route has indeed a rate-limit, but the headers aren't exposed.
Point was that we are indeed hitting 429s on this. Just edited in something to address that.
What is the ratelimit scope? – If this is missing then it's a bug.
There are three potential cases:
Retry-After
header (of around 1 second).Retry-After
header (of around 50 minutes).Rate limit scope isn't required for this to be a bug, but a missing Retry-After
header would be.
Related: https://github.com/discord/discord-api-docs/issues/5144
This is indeed a bug, a fix should be rolled out soonish.
Edit: Posted as the same time than devsnek who said it's a bug, so I may be totally wrong here :upside_down_face:
Here is what I understand regarding this endpoint and returned headers:
user
) ratelimit on this endpoint, because there isn't any major parameter (guild or channel id) that can be used. This explains why there is not any X-Ratelimit-*
headers returned on success responses.X-RateLimit-Scope: shared
and Retry-After
headers when exceeding it.
X-RateLimit-Remaining
is not equal to 0
as you may expectX-RateLimit-Reset-After
(which is about your user ratelimit) is not equal to Retry-After
(which is about the shared ratelimit you hit).X-RateLimit-{Limit,Remaining,Reset,Reset-After,Bucket}
always represents the user's ratelimit state (even if you are encountering another ratelimit type)fix should be out very soon
@devsnek What was the fix?
Description
Calling the
DELETE
HTTP method on/invites/:code
provides no ratelimit headers in the response, eventually leading to rate limits for bots that often call this route, i.e. a@discordjs/rest
/discord.js
v14 bot's debug log:Note how we have no relevant information e.g. the
Limit
(which would come fromx-ratelimit-limit
), but just the timeout andGlobal: false
which is returned in the JSON payload from the 429.Steps to Reproduce
curl -i -H "Authorization: Bot $DISCORD_TOKEN" -X DELETE https://discord.com/api/v10/invites/[somecode]
- assumingDISCORD_TOKEN
is a variable in your shell, and[somecode]
is a valid invite code your bot can manage.Expected Behavior
The response includes
x-ratelimit-[whatever]
headers.Current Behavior
The response does not include any ratelimit headers:
Screenshots/Videos
No response
Client and System Information