Electron renderer crashes after importing @discordjs/voice

In my electron project I have the renderer set up as below:
let win = new BrowserWindow({
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
sandbox: false,
devTools: !app.isPackaged
},
autoHideMenuBar: true
})

win.loadFile(resolve(__dirname, "../../static/index.html"));
let win = new BrowserWindow({
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
sandbox: false,
devTools: !app.isPackaged
},
autoHideMenuBar: true
})

win.loadFile(resolve(__dirname, "../../static/index.html"));
Everything works fine until I run require("@discordjs/voice"); (also tried this in DevTools console), when the whole window turns black and DevTools says
DevTools was disconnected from the page. Once page is reloaded, DevTools will automatically reconnect.
I have looked at Electron docs and there it says that DevTools disconnecting signalizes a V8 crash. With --enable-logging Electron flag, the only thing printed out in console is:
Renderer process crashed - see https://www.electronjs.org/docs/tutorial/application-debugging for potential debugging information.
Renderer process crashed - see https://www.electronjs.org/docs/tutorial/application-debugging for potential debugging information.
generateDependencyReport() output:
--------------------------------------------------
Core Dependencies
- @discordjs/voice: 0.18.0
- prism-media: 1.3.5

Opus Libraries
- @discordjs/opus: 0.10.0
- opusscript: not found

Encryption Libraries
- sodium-native: 5.0.3
- sodium: not found
- libsodium-wrappers: not found
- @stablelib/xchacha20poly1305: not found
- @noble/ciphers: not found

FFmpeg
- version: 7.1.1-full_build-www.gyan.dev
- libopus: yes
--------------------------------------------------
--------------------------------------------------
Core Dependencies
- @discordjs/voice: 0.18.0
- prism-media: 1.3.5

Opus Libraries
- @discordjs/opus: 0.10.0
- opusscript: not found

Encryption Libraries
- sodium-native: 5.0.3
- sodium: not found
- libsodium-wrappers: not found
- @stablelib/xchacha20poly1305: not found
- @noble/ciphers: not found

FFmpeg
- version: 7.1.1-full_build-www.gyan.dev
- libopus: yes
--------------------------------------------------
How do I solve this?
Application Debugging | Electron
Whenever your Electron application is not behaving the way you wanted it to, an array of debugging tools might help you find coding errors, performance bottlenecks, or optimization opportunities.
4 Replies
d.js toolkit
d.js toolkit3w ago
- What are your intents? GuildVoiceStates is required to receive voice data! - Show what dependencies you are using -- generateDependencyReport() is exported from @discordjs/voice. - Try looking at common examples: https://github.com/discordjs/voice-examples. - 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!
Muffoi
MuffoiOP3w ago
It probably is not common, I wanted to make a bot to be configured from an app Or something like that
pat
pat3w ago
if you want to make a configuration window i think you should separate the processes
Muffoi
MuffoiOP3w ago
Isn’t there a way to make it work without separation?

Did you find this page helpful?