opus: Error: FATAL ERROR: Error::ThrowAsJavaScriptException napi_throw #5081

Please describe the problem you are having in as much detail as possible: I get error when trying to play music, it looks like its the problem with discord.js opus

Further details:

  • @discordjs/opus version: 12.5.1
  • Node.js version: >12, not sure which one because am using hosting!
  • Operating system: Linux
  • Priority this issue should have – please be realistic and elaborate if possible: It’s not that required right now, but would be great if got fast response
FATAL ERROR: Error::ThrowAsJavaScriptException napi_throw
1: 0xa17c40 node::Abort() [/usr/local/bin/node]
2: 0xa1804c node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
3: 0xa180e9 [/usr/local/bin/node]
4: 0x9ebbfb napi_fatal_error [/usr/local/bin/node]
5: 0x7f62802e74b6 [/home/container/node_modules/@discordjs/opus/prebuild/node-v72-napi-v3-linux-x64-glibc-2.28/opus.node]
6: 0x7f62802e79eb Napi::Error::ThrowAsJavaScriptException() const [/home/container/node_modules/@discordjs/opus/prebuild/node-v72-napi-v3-linux-x64-glibc-2.28/opus.node]
7: 0x7f62802f20d8 OpusEncoder::Decode(Napi::CallbackInfo const&) [/home/container/node_modules/@discordjs/opus/prebuild/node-v72-napi-v3-linux-x64-glibc-2.28/opus.node]
8: 0x7f62802e9f47 Napi::InstanceWrap<OpusEncoder>::InstanceMethodCallbackWrapper(napi_env__*, napi_callback_info__*) [/home/container/node_modules/@discordjs/opus/prebuild/node-v72-napi-v3-linux-x64-glibc-2.28/opus.node]
9: 0x9cfc55 [/usr/local/bin/node]
10: 0xc019e9 [/usr/local/bin/node]
11: 0xc037d7 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
12: 0x1409319 [/usr/local/bin/node]
/entrypoint.sh: line 12: 3013 Aborted (core dumped) /usr/local/bin/node /home/container/${BOT_JS_FILE} 

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 19 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Can we reopen this issue as its occuring on Node version 15.5.0 for me aswell.

System Details OS: Arch Linux x86_64 KERNEL: 5.9.11-arch2-1 CPU: Intel i5-8300H (8) @ 4.000GHz GPU: NVIDIA GeForce GTX 1060 Mobile 6GB

Stacktrace

FATAL ERROR: Error::ThrowAsJavaScriptException napi_throw
 1: 0x557a8e8fa1c1 node::Abort() [node]
 2: 0x557a8e81d13a node::FatalError(char const*, char const*) [node]
 3: 0x557a8e81d143  [node]
 4: 0x557a8e8c635b napi_fatal_error [node]
 5: 0x7fde841506aa  [/home/[REDACTED]/node_modules/@discordjs/opus/prebuild/node-v88-napi-v3-linux-x64-glibc-2.32/opus.node]
 6: 0x7fde84150dfc Napi::Error::ThrowAsJavaScriptException() const [/home/[REDACTED]/node_modules/@discordjs/opus/prebuild/node-v88-napi-v3-linux-x64-glibc-2.32/opus.node]
 7: 0x7fde8415cc68 OpusEncoder::Decode(Napi::CallbackInfo const&) [/home/[REDACTED]/node_modules/@discordjs/opus/prebuild/node-v88-napi-v3-linux-x64-glibc-2.32/opus.node]
 8: 0x7fde841543a7 Napi::InstanceWrap<OpusEncoder>::InstanceMethodCallbackWrapper(napi_env__*, napi_callback_info__*) [/home/[REDACTED]/node_modules/@discordjs/opus/prebuild/node-v88-napi-v3-linux-x64-glibc-2.32/opus.node]
 9: 0x557a8e8a6db5  [node]
10: 0x557a8eb37247 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [node]
11: 0x557a8eb3802e  [node]
12: 0x557a8eb38522  [node]
13: 0x557a8eb387d6 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
14: 0x557a8f305439  [node]

I can confirm that every time this issues occur it is linked to someone using the web client of Discord. Forcing them to use the desktop client seems to fix it permanently.

The main problem is that I think it should be proper opus (it’s the stream coming from a VoiceReceiver). I have this issue when it listens to a browser based discord client but not the application based ones (the iOS and Windows apps are fine).

Yes, this is a very thin wrapper around native opus. There will be no error handling in this library as a design choice. You will need to make sure that whatever you are passing is actually proper opus.