discordjs / discord.js

A powerful JavaScript library for interacting with the Discord API
https://discord.js.org
Apache License 2.0
25.2k stars 3.96k forks source link

Voice stream errors #9627

Closed AlloryDante closed 1 year ago

AlloryDante commented 1 year ago

Which package is this bug report for?

voice

Issue description

I simply connect to a voice channel and when I try to do

const opusStream = receiver.subscribe(userId, {
        end: {
            behavior: EndBehaviorType.AfterSilence,
            duration: 100
        }
    });

I get the following error:

RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 10. Received 11
    at new NodeError (node:internal/errors:399:5)
    at boundsError (node:internal/buffer:88:9)
    at Buffer.readUInt8 (node:internal/buffer:254:5)
    at j.parsePacket (/root/Catalina/node_modules/@discordjs/voice/dist/index.js:8:5714)
    at j.onUdpMessage (/root/Catalina/node_modules/@discordjs/voice/dist/index.js:8:6058)
    at L.emit (node:events:513:28)
    at L.onMessage (/root/Catalina/node_modules/@discordjs/voice/dist/index.js:1:5863)
    at Socket.<anonymous> (/root/Catalina/node_modules/@discordjs/voice/dist/index.js:1:5393)
    at Socket.emit (node:events:513:28)
    at UDP.onMessage [as onmessage] (node:dgram:933:8) {
  code: 'ERR_OUT_OF_RANGE'
}

This error happens when bot joins a channel full of people. If the bot joins a channel with only 1 member, I get a new error:

node:events:491
      throw er; // Unhandled 'error' event
      ^

Error [ERR_STREAM_PUSH_AFTER_EOF]: stream.push() after EOF
    at new NodeError (node:internal/errors:399:5)
    at readableAddChunk (node:internal/streams/readable:285:30)
    at Readable.push (node:internal/streams/readable:234:10)
    at U.push (/root/Catalina/node_modules/@discordjs/voice/dist/index.js:8:3227)
    at j.onUdpMessage (/root/Catalina/node_modules/@discordjs/voice/dist/index.js:8:6174)
    at L.emit (node:events:513:28)
    at L.onMessage (/root/Catalina/node_modules/@discordjs/voice/dist/index.js:1:5863)
    at Socket.<anonymous> (/root/Catalina/node_modules/@discordjs/voice/dist/index.js:1:5393)
    at Socket.emit (node:events:513:28)
    at UDP.onMessage [as onmessage] (node:dgram:933:8)
Emitted 'error' event on U instance at:
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 'ERR_STREAM_PUSH_AFTER_EOF'
}

I also want to mention that yesterday when I tested the code it didnt had any problems. Today Its my first time when I see those problems

Code sample

https://github.com/AlloryDante/CatalinaGPT/blob/master/modules/handleVoice.js

Line 24 to line 52.

Versions

"dependencies": { "@discordjs/opus": "^0.9.0", "@discordjs/voice": "^0.8.0", "discord.js": "^13.0.1", "discord.js-selfbot-v13": "^2.14.3", "dotenv": "^16.1.4", "libsodium-wrappers": "^0.7.11", "node-capmonster": "^0.4.2", "node-wit": "^6.6.0", "nodemon": "^2.0.22", "openai": "^3.2.1" }

Issue priority

Medium (should be fixed soon)

Which partials do you have configured?

No Partials

Which gateway intents are you subscribing to?

No Intents

I have tested this issue on a development release

No response

Jiralite commented 1 year ago

You're reporting a bug on a really old & deprecated version. Update and try again?

AlloryDante commented 1 year ago

You're reporting a bug on a really old & deprecated version. Update and try again?

I am so stupid, I dont know how I manage to have those old verseions of libs. Excuse me and really thank you for everything.