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:
This is from:
Does anyone have some pointers as to thing I should check, as to why this may occur?
Thanks6 Replies
- 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 staffv20.11.1
Code is avaliable here:
https://github.com/LamboCreeper/discord-festival-bot/blob/master/src/services/AudioService.tsyour 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 necessaryRight, 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!
it doesn't have to be to local disk, in memory is fine
createAudioResource
accepts a streamOkay 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! 🙂