Discord.Net icon indicating copy to clipboard operation
Discord.Net copied to clipboard

[Bug]: Discord Caching can prevent connection to the gateway

Open ndelta0 opened this issue 2 years ago • 3 comments

Check The Docs

  • [X] I double checked the docs and couldn't find any useful information.

Verify Issue Source

  • [X] I verified the issue was caused by Discord.Net.

Check your intents

  • [X] I double checked that I have the required intents.

Description

Discord could possibly cache an invalid response for the /gateway endpoint thus preventing the connection to the Gateway. Today at around 11 AM UTC Discord cached the following response for about 5 hours (depending on the geological location):

{
  "global": true,
  "message": "You are being rate limited.",
  "retry_after": 0.77
}

thus not getting the Gateway address and not being able to connect.

My recommendation would be to either:

  • Try calling the gateway endpoint with a random query argument
  • Always use the /gateway/bot endpoint which requires authentication and thus is not cached

Version

3.x

Working Version

No response

Logs

n/a

Sample

No response

Packages

n/a

ndelta0 avatar May 25 '22 17:05 ndelta0

seems to be resolved

quinchs avatar May 27 '22 11:05 quinchs

it was resolved, this issue does not target that

this issue targets a future prevention on ~~if~~ when this happens another time

a good and future-proof fix would be to use /gateway/bot for the reason said in the issue body

ooliver1 avatar May 27 '22 17:05 ooliver1

Kind of a late update... Hey from 2023 The library uses /gateway/bot, so i'm closing this.

Misha-133 avatar Dec 04 '23 22:12 Misha-133