#Getting disconnected from voice only on local dev machine

57 messages · Page 1 of 1 (latest)

delicate palm
#

When using my bot from the dev environment the bot will join the voice channel and play audio for around 2 mins and leave. in my logs I can see that the AudioPlayer state is changed from playing to idle.

The same exact code and parameters on my VPS does not encounter the same issue. (I do use a different production bot on the VPS)

This issue is fairly recent, everything used to work fine.

I have tried everything I can think of: using a different bot account, using a VPN, even reinstalling my dev OS. I'm going insane. Anyone run into an issue like this?

heavy lionBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

high sluice
#

Whats you logic for the player events, like idle?

delicate palm
#

@high sluice I just log it. Is there something I should be doing in it? It's worked this way for a year.

high sluice
#

Can you send me your code pls?

heavy lionBOT
#

To share long code snippets use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks.

tidal sparrow
#

This could be any number of reasons like network instability or something of the sort. What source are you attempting to play audio from and what are you doing to fetch the source material?

floral swift
delicate palm
delicate palm
delicate palm
high sluice
#

Guide me pls, what file is the problem

floral swift
delicate palm
delicate palm
floral swift
#

It's been a week that I'm trying to reconnect it after a disconnection, but nothing to do, I'll see if they have changed something

floral swift
floral swift
delicate palm
#

Thankfully, my bot is still working in the production environment which makes the issue even stranger

floral swift
#

for my part I use

"@discordjs/voice": "^0.10.0",
"discord.js": "^13.8.0",
#

I will try to download the latest version of discordjs/voice, see if it changes anything, I'll let you know

#

ok it still doesn't work

floral swift
clever shard
#

I'm not sure it's just you... I've been experiencing something similar. Two issues:

  1. Sometimes (seems random) after I restart my bot a couple of times, it will no longer get to a fully "Ready" state. It's connected to the channel (listed in the user list) but instead of going to "Ready" I get an Abort error. ```AbortError: The operation was aborted
    at abortListener (node:events:970:14)
    at AbortSignal.<anonymous> (node:events:1006:47)
    at AbortSignal.[nodejs.internal.kHybridDispatch] (node:internal/event_target:643:20)
    at AbortSignal.dispatchEvent (node:internal/event_target:585:26)
    at abortSignal (node:internal/abort_controller:284:10)
    at AbortController.abort (node:internal/abort_controller:315:5)
    at Timeout.<anonymous> (/Users/sascha/dev/investing/Hermes/node_modules/@discordjs/voice/dist/index.js:1991:39)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7) {
    code: 'ABORT_ERR'
2) Even if the bot does connect and go to "Ready", after some amount of (successfully playing) time it just doesn't actually play the audio. No errors, logs seem to indicate resource was created and queued. Just no actual audio.
#

For the first problem, if I delete and create a new bot and token and then run the same code - voila, connects fine. Which makes me wonder if it's some sort of discord blacklist/throttling. But I've not read of anything like that anywhere.

floral swift
floral swift
clever shard
# floral swift what is strange is that in our cases we have no errors, and I also thought about...

Yes, I've been having the issue for a few days. It could be a combination of IP/Token/channel. I really can't think of anything else. Since I can also use the same token + server to connect to a different guild without issue. If I could solve #2 it wouldn't be such a problem since I'd just connect once and only ever re-connect if I had to restart the server the bot was running on. Still wouldn't explain it, but I could live with just having to refresh my token/bot every few weeks.

floral swift
clever shard
#

if I delete/recreate the bot - yah

floral swift
#

because me, all the connections of all the servers are destroyed at one time, without reasons while in my script at no time I ask the destroy of the connections

floral swift
clever shard
#

I used the example code as my template, so once I get that AbortError, it destroys the connection

#
    console.log('Connecting to vChannel', channel.id);
    const cxn = joinVoiceChannel({
        channelId: channel.id,
        guildId: channel.guild.id,
        adapterCreator: channel.guild.voiceAdapterCreator as unknown as DiscordGatewayAdapterCreator,
        selfDeaf: false,
        selfMute: false,
    });
    try {
        await entersState(cxn, VoiceConnectionStatus.Ready, 40_000);
        console.log('connected channel', cxn.state);
        return cxn;
    } catch (error) {
        console.log('Error esstablishing cxn to vChannel:', error, cxn);
        cxn.destroy();
        throw error;
    }
};```
floral swift
clever shard
#

Yes, thx I saw that - but I'm telling it to enter Ready state before I return the connection back (per the example mentioned)

floral swift
#

the problem is that I have no error, and I only see a "blacklist" from Discord, but how to get out of the blacklist, I do not know

clever shard
#

Are you seeing that the same code + token can connect to other voice channels in the same guild?

floral swift
#

this error drives me crazy 😭

clever shard
#

I just now ran my code from the same machine, all I did was swap out the channel ID and it connects to one but not the other.

#

tell me about it

floral swift
clever shard
#

but the one that is failing was working earlier before somehow it got "blocked" (for lack of a better term/explanation)

floral swift
#

However, there is no information about an update of the API or anything else...

tidal sparrow
#

Should either of you be using the built in entersState function, you shouldn't be as it has issues and this is a good example of what those issues are.

If you'd like a good replacement, you can try https://github.com/AmandaDiscord/Volcano/blob/main/src/worker.ts#L82
Do keep in mind that it's written in TypeScript, so you'll have to remove the TS only code if you want it to work in JS.

If you want to facepalm at discord.js for refusing to fix this, see https://github.com/discordjs/discord.js/pull/8251

GitHub

entersState currently uses internal node modules and abort controllers which locks the thread and causes an AbortError to be thrown. This is remedied by having the user create their own entersState...

GitHub

A light-weight LavaLink compatible replacement. Contribute to AmandaDiscord/Volcano development by creating an account on GitHub.

floral swift
tidal sparrow
#

The entersState function returns a Promise waiting for a resource like a connection or AudioResource to enter a specific state like playing and if it doesn't enter that state in time, then an error is likely present and should be addressed.

floral swift
tidal sparrow
#

As far as I know, the only work around for the abort errors was to just make your own function as you couldn't capture it and control it and it's erroneous logic

slender cedar
#

Hey!

#

I'm having this issue too, just without the error

#

I'm going nuts, I've tried opening UDP ports on my firewall and no luck

#

Did any of you find a solution?