TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buff
I am currently using this to join a voice channel and play back audio, but I am getting the error "TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received type number (73)"
As a sanity check I logged my buffer which of course was indeed a buffer, what am I doing wrong?
Output:
5 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 OPnode: v20.6.1
djs: @14.13.0
@djs/voice: @0.16.0
(I tried replacing the buffer for a file path, which no longer gave an error but also didn't play anything back)
(It ended up working with file path, it was simply unclear that I was missing an intent there.. however the buffer method still isn't working, and throws the same error, I also did try making the buffer into a UInt8Array)
@Paige createAudioResource doesn't support buffers as input so it's reasonable that it's throwing an error. Maybe you should convert it to a Readable/Passthrough, which would be something like:
I'm unsure if that would work, but it's a good try
Yeah I figured that out after reading the source code haha
🤣 Awesome to know you solved it :)