discord.js: Voice: connection timeout after 15 seconds.
Please describe the problem you are having in as much detail as possible: When attempting to play a YTDL stream in a voice channel, there seems to an issue with the connection timeout.
{ Error [VOICE_CONNECTION_TIMEOUT]: Connection not established within 15 seconds.
0|mrFox | at VoiceConnection.authenticateFailed (/home/rich/Fox/node_modules/discord.js/src/client/voice/VoiceConnection.js:268:27)
0|mrFox | at connectTimeout.client.setTimeout (/home/rich/Fox/node_modules/discord.js/src/client/voice/VoiceConnection.js:297:18)
0|mrFox | at Timeout.setTimeout (/home/rich/Fox/node_modules/discord.js/src/client/BaseClient.js:81:7)
0|mrFox | at ontimeout (timers.js:436:11)
0|mrFox | at tryOnTimeout (timers.js:300:5)
0|mrFox | at listOnTimeout (timers.js:263:5)
0|mrFox | at Timer.processTimers (timers.js:223:10) [Symbol(code)]: 'VOICE_CONNECTION_TIMEOUT' }
I am not sure why this is happening, as music worked server weeks ago, with no code change, only an upgrade in discord.js version.
Include a reproducible code sample here, if possible:
const dispatcher: StreamDispatcher = serverQueue.connection.play(
ytdl(song.url, { filter: "audioonly" }),
{ bitrate: "auto" }
);
The bot can join, but will error here.
Further details:
- discord.js version: 12…0.0-dev lastest commit
- Node.js version: 10.14.1
- Operating system: Ubuntu 18.04
- Priority this issue should have – please be realistic and elaborate if possible: Medium, as I cannot serve streams at all.
- [ x] I have also tested the issue on latest master, commit hash:
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 23 (2 by maintainers)
Commits related to this issue
- voice: more debug information #3074, #2979, #3044 — committed to discordjs/discord.js by amishshah 5 years ago
I also have this issue occasionally. Ubuntu 18.04.1 LTS Node.js: v10.15.0 Discord.js version: master branch
I made a small custom soundboard and it seems like that it happens if no one was active in voice for a few hours. After a few tries / restarting the bot it fixes itself at some point. I know, not the best description to reproduce all of this, but I try to give more information if this issue persist.
EDIT: Switching voice regions kinda seems to fix the issue for some time, until it just doesn’t work anymore.
I actually found a solution that fixed the error completely for my circumstance. In my index.js file I have a list of gateway intents, and it was missing GUILD_VOICE_STATES. Once I added it in, the bot worked flawlessly for it’s intended purpose.
Took me some time to realise this, and not too sure how I missed it the first few times over.