AudioPlayerStatus Stuck in Buffering State

Making another post in djs-voice after being directed here by another member I have a bot that can play Audio and has successfully done so for the last while. I have two instances with their own Apps, a test bot and one run on a cloud server. Both are running the following discord dependencies:
"@discordjs/builders": "^1.8.1",
"@discordjs/voice": "^0.17.0",
"discord.js": "^14.15.2"
"@discordjs/builders": "^1.8.1",
"@discordjs/voice": "^0.17.0",
"discord.js": "^14.15.2"
npm list: [email protected] -> .\node_modules\.pnpm\[email protected]\node_modules\discord.js Node LIVE: 20.8.0 20.13.1 Node TEST: 20.11.1 Recently, the live bot running on the cloud server has stopped working. After debugging this for a while, I've determined that it seems to be getting stuck in the "Buffering" AudioPlayerStatus. Oddly, despite running the exact same code, the test bot does not get stuck in this state. The only things left are the server/host machine (and the live server has also been operating just fine up until recently) and the discord App for the bot itself. Does anyone have any extra information that might shed some light? Will happily share some more details if anyone lets me know relevant things missing from the post.
4 Replies
d.js toolkit
d.js toolkit7mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
MerfAvenger
MerfAvengerOP7mo ago
It's a remote resource, although I've tried the same one(s) between both of those hosts.
SkyLissh
SkyLissh7mo ago
I was having this issue using bun as runtime, after struggling a while, I tried with node and it magically worked, so maybe your hosted project is running in a different runtime, like a cloudfare worker or a vercel function?
MerfAvenger
MerfAvengerOP6mo ago
Unfortunately it's pretty much as simple as it gets, except for being wrapped in pm2. I did try upgrading from 2.8.0 to 2.13.1 but it's exactly the same issue, and my test server is running fine on 20.11.1. I've been upping the anti on my logging and found the following, which happens some indeterminate amount of time after the audio player gets to the buffering state:

Audio resource error: AggregateError:
at internalConnectMultiple (node:net:1117:18)
at afterConnectMultiple (node:net:1684:7)

Audio resource error: AggregateError:
at internalConnectMultiple (node:net:1117:18)
at afterConnectMultiple (node:net:1684:7)
If I output the raw error object, I get a cyclical JSON parsing error so I assume the stream object is also output, this is the message and stack trace And my test bot now has the same symptoms, with the only difference being that it most likely only had an npm package update more recently. So I suspect it's not really my code but something else which has changed. The library I use for the streams has not updated in ~8 months, so discord seems like the only candidate if its a deps error. Yeah I'm trying both with the same url to load the stream from And have tried a few different urls including ones that have worked in the past. Making a stream first, I'm using the play-dl library. I guess it's very possible that the stream source itself has changed, but then I would expect other people using the library to be complaining of the same problem fairly en-masse. I'll keep an eye on that community though because I have seen people report some fairly similar errors recently. The only thing that would confuse me there is why the test bot did work originally when the live one was failing, it seems more like a deps update than the source changing. That's a TOS violation..? I'm not actually downloading the videos, just streaming. I'm happy to reread the TOS but to my knowledge this isn't downloading the video and uploading it, it's similar to using the youtube API to embed things as an app. I'm rereading the API TOS and they've got a number of pieces around skipping ads, which I guess is the crux of it. That's a shame, and I kinda wonder if there's a way to do that with the ads included. I do think that's solved though because there's an article from last month saying that the buffering issues are a result of this, so I guess I'm going to have to find a new project..
Want results from more Discord servers?
Add your server