DSharpPlus / DSharpPlus

A .NET library for making bots using the Discord API.
https://discord.gg/dsharpplus
MIT License
1.24k stars 305 forks source link

Failed to decompress a gateway payload #2015

Open wthks opened 1 month ago

wthks commented 1 month ago

Summary

fail: DSharpPlus.Net.Gateway.IGatewayClient - Shard 0[0]
      Reconnecting failed, waiting for 00:00:04
      System.IO.InvalidDataException: Failed to decompress a gateway payload.
         at DSharpPlus.Net.Gateway.TransportService.ReadAsync()
         at DSharpPlus.Net.Gateway.GatewayClient.TryReconnectAsync()

What version of the library are you using?

v5.0.0-nightly (make sure you are using the latest nightly!)

What .NET version are you using? Make sure to use the latest patch release for your major version.

.NET 9.0 Previews

Operating System

windows

Reproduction Steps


var discordClient = DiscordClientBuilder.CreateSharded(discordToken, DiscordIntents.AllUnprivileged)
    .ConfigureLogging(a => a
        .AddConsole()
        .SetMinimumLevel(LogLevel.Debug))
    .ConfigureExtraFeatures(a => a.GatewayCompressionLevel = GatewayCompressionLevel.Payload))
    .Build();

await discordClient.ConnectAsync();

Trace Logs

trce: DSharpPlus.Net.Gateway.ITransportService - Shard 0[0]
      Connecting to the Discord gateway.
trce: DSharpPlus.Net.Gateway.ITransportService - Shard 0[0]
      Connected to the Discord websocket.
fail: DSharpPlus.Net.Gateway.IGatewayClient - Shard 0[0]
      Encountered an error while connecting.
      System.IO.InvalidDataException: Failed to decompress a gateway payload.
         at DSharpPlus.Net.Gateway.TransportService.ReadAsync()
         at DSharpPlus.Net.Gateway.GatewayClient.ConnectAsync(String url, DiscordActivity activity, Nullable`1 status, Nullable`1 idleSince, ShardInfo shardInfo)
warn: DSharpPlus.Net.Gateway.ITransportService - Shard 0[0]
      Attempted to connect, but there already is a connection opened. Ignoring.
trce: DSharpPlus.Net.Gateway.IGatewayClient - Shard 0[0]
      Attempting reconnect, attempt 1
trce: DSharpPlus.Net.Gateway.ITransportService - Shard 0[0]
      Disconnect requested: NormalClosure
trce: DSharpPlus.Net.Gateway.ITransportService - Shard 0[0]
      Connecting to the Discord gateway.
trce: DSharpPlus.Net.Gateway.ITransportService - Shard 0[0]
      Connected to the Discord websocket.
fail: DSharpPlus.Net.Gateway.IGatewayClient - Shard 0[0]
      Reconnecting failed, waiting for 00:00:01
      System.IO.InvalidDataException: Failed to decompress a gateway payload.
         at DSharpPlus.Net.Gateway.TransportService.ReadAsync()
         at DSharpPlus.Net.Gateway.GatewayClient.TryReconnectAsync()
trce: DSharpPlus.Net.Gateway.IGatewayClient - Shard 0[0]
      Attempting reconnect, attempt 2
trce: DSharpPlus.Net.Gateway.ITransportService - Shard 0[0]
      Disconnect requested: NormalClosure
trce: DSharpPlus.Net.Gateway.ITransportService - Shard 0[0]
      Disconnecting. Current websocket state: Open
trce: DSharpPlus.Net.Gateway.ITransportService - Shard 0[0]
      Connecting to the Discord gateway.
trce: DSharpPlus.Net.Gateway.ITransportService - Shard 0[0]
      Connected to the Discord websocket.
fail: DSharpPlus.Net.Gateway.IGatewayClient - Shard 0[0]
      Reconnecting failed, waiting for 00:00:02
      System.IO.InvalidDataException: Failed to decompress a gateway payload.
         at DSharpPlus.Net.Gateway.TransportService.ReadAsync()
         at DSharpPlus.Net.Gateway.GatewayClient.TryReconnectAsync()

Exceptions or other error messages

No response

Anything else you'd like to share

No response

Plerx2493 commented 1 month ago

2000 aims to rework our gateway decompression. For now please use DecompressionLevel.Stream or DecompressionLevel.None. The former option results in a better compression rate anyways