Bot Works Locally, In Production Player States Goes To Idle Straight Away?

Hi, I'm having an issue with my bot in production. It works fine locally (macOS), but in production (Docker node:20 image), the player state changes from playing to idle straight away:
2024-04-19T21:18:59.218838568Z Player state changed from idle to buffering 2024-04-19T21:18:59.219003344Z Player state changed from idle to buffering 2024-04-19T21:18:59.219081585Z Player state changed from idle to buffering 2024-04-19T21:18:59.219159240Z Player state changed from idle to buffering 2024-04-19T21:18:59.424853162Z Player state changed from buffering to playing 2024-04-19T21:18:59.424882300Z Player state changed from buffering to playing 2024-04-19T21:18:59.424931457Z Player state changed from buffering to playing 2024-04-19T21:18:59.425016947Z Player state changed from buffering to playing 2024-04-19T21:18:59.559298570Z Player state changed from playing to idle 2024-04-19T21:18:59.559400012Z Player state changed from playing to idle 2024-04-19T21:18:59.559409250Z Player state changed from playing to idle 2024-04-19T21:18:59.559414376Z Player state changed from playing to idle
2024-04-19T21:18:59.218838568Z Player state changed from idle to buffering 2024-04-19T21:18:59.219003344Z Player state changed from idle to buffering 2024-04-19T21:18:59.219081585Z Player state changed from idle to buffering 2024-04-19T21:18:59.219159240Z Player state changed from idle to buffering 2024-04-19T21:18:59.424853162Z Player state changed from buffering to playing 2024-04-19T21:18:59.424882300Z Player state changed from buffering to playing 2024-04-19T21:18:59.424931457Z Player state changed from buffering to playing 2024-04-19T21:18:59.425016947Z Player state changed from buffering to playing 2024-04-19T21:18:59.559298570Z Player state changed from playing to idle 2024-04-19T21:18:59.559400012Z Player state changed from playing to idle 2024-04-19T21:18:59.559409250Z Player state changed from playing to idle 2024-04-19T21:18:59.559414376Z Player state changed from playing to idle
This is from:
player.on('stateChange', (oldState, newState) => {
console.log(`Player state changed from ${oldState.status} to ${newState.status}`)
})
player.on('stateChange', (oldState, newState) => {
console.log(`Player state changed from ${oldState.status} to ${newState.status}`)
})
Does anyone have some pointers as to thing I should check, as to why this may occur? Thanks
6 Replies
d.js toolkit
d.js toolkit6mo 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 staff
Lambo
Lambo6mo ago
├── discord.js@14.14.1
└─┬ discordx@11.9.0
└── discord.js@14.14.1 deduped
├── discord.js@14.14.1
└─┬ discordx@11.9.0
└── discord.js@14.14.1 deduped
v20.11.1 Code is avaliable here: https://github.com/LamboCreeper/discord-festival-bot/blob/master/src/services/AudioService.ts
duck
duck6mo ago
your deps and intents check out, so it's more likely to either be an issue with the audio itself or the way you're playing it searching around, I saw that in some (all?) cases, you create the audio resource from the url directly ffmpeg normally can stream audio from a url, but I have noticed that sometimes this silently fails on some linux distros so if you're specifically having issues playing a resource created directly from a url and streaming it yourself (possibly with undici) fixes it, that'd be it as a side note, the issue that required the fix you have on line 30 in this file has since been fixed, so that shouldn't be necessary
Lambo
Lambo6mo ago
Right, say that’s the case, would the recommendation be to download the audio file to the local disk and play it from there, rather than stream via ffmpeg under the hood? Okay sweet!
duck
duck6mo ago
it doesn't have to be to local disk, in memory is fine createAudioResource accepts a stream
Lambo
Lambo6mo ago
Okay cool, I’ll try get a stream of the URL via Axios and pass that in - thanks This is what I get for only testing in production the day before I need the bot for something :facepalm: @duck just wanted to let you know that this has sorted the issue, thank you so much! 🙂
Want results from more Discord servers?
Add your server