Skip to content
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

RangeError: Invalid WebSocket frame: RSV1 must be clear #10228

Open
kevinlul opened this issue Apr 24, 2024 · 5 comments
Open

RangeError: Invalid WebSocket frame: RSV1 must be clear #10228

kevinlul opened this issue Apr 24, 2024 · 5 comments

Comments

@kevinlul
Copy link

Which package is this bug report for?

discord.js

Issue description

Over the past month, we received three instances of this error event emitted from the Discord.js client:

RangeError: Invalid WebSocket frame: RSV1 must be clear
    at Receiver.getInfo (/app/node_modules/@discordjs/ws/node_modules/ws/lib/receiver.js:213:26)
    at Receiver.startLoop (/app/node_modules/@discordjs/ws/node_modules/ws/lib/receiver.js:159:16)
    at Receiver._write (/app/node_modules/@discordjs/ws/node_modules/ws/lib/receiver.js:98:10)
    at writeOrBuffer (node:internal/streams/writable:564:12)
    at _write (node:internal/streams/writable:493:10)
    at Writable.write (node:internal/streams/writable:502:10)
    at TLSSocket.socketOnData (/app/node_modules/@discordjs/ws/node_modules/ws/lib/websocket.js:1303:35)
    at TLSSocket.emit (node:events:518:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3) {
  code: 'WS_ERR_UNEXPECTED_RSV_1',
  [Symbol(status-code)]: 1002
}

The occurrences at Eastern Time: 2024-03-13 14:22, 2024-04-19 04:36, 2024-04-24 17:10

Client setup: https://github.com/DawnbrandBots/bastion-bot/blob/master/src/bot.ts#L27-L55

It's not clear if this event is reproducible or an error on Discord's end, e.g. receiving malformed packets from the gateway.

Code sample

No response

Versions

  • discord.js 14.14.1
  • TypeScript 5.4.4
  • Node.js 20.12.2 (Docker node:20-bullseye base image)
  • Docker version 20.10.2, build 2291f61
  • Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-169-generic x86_64)

Issue priority

Low (slightly annoying)

Which partials do you have configured?

Channel, Message

Which gateway intents are you subscribing to?

Guilds, GuildMessages, DirectMessages, MessageContent

I have tested this issue on a development release

No response

@Qjuh
Copy link
Contributor

Qjuh commented Apr 25, 2024

When you say

error event emitted from the discord.js client

what event are you referring to? Is it Client#shardError? If it is then that is indeed an error about an invalid package received (specifically they sent a compressed package but permessage-deflate was not used). This could either be discord sending that invalid package or your docker container interfering. You could debug this by logging the received data on the underlying socket, but that would need to go deep into private properties of discord.js, @discordjs/ws and ws to get to the _socket property of the used WebSocket.

@kevinlul
Copy link
Author

It is a shardError.

@vladfrangu
Copy link
Member

We've asked Discord about this, waiting on more status updates 🤞

@Nico-ITA
Copy link

Nico-ITA commented Apr 27, 2024

Im also getting this Shard Error Event ( last discord.js version )
image

@vladfrangu
Copy link
Member

Several other libraries have encountered similar issues (JDA, dpy to name a few). We're just waiting on more info at this point!

@discordjs discordjs deleted a comment from SamirMishra27 Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants