Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Using raven-node within an Electron renderer process #441

Open
jlongster opened this issue Mar 25, 2018 · 1 comment
Open

Using raven-node within an Electron renderer process #441

jlongster opened this issue Mar 25, 2018 · 1 comment

Comments

@jlongster
Copy link

Electron has two type of processes, the main process which controls everything, and individual renderer processes which represent separate UI processes. The renderer process may have "node integration" enabled, meaning you have full access to node APIs.

You want to run as little JS on the main process as possible (see my post). Because of this, I'm running my entire backend in a hidden renderer process that I basically use as just a node process (there's zero UI and no usage of browser APIs). It's treated as a node program.

The problem is sentry really wants you to use raven-js in the renderer process. Running raven-node inside a renderer process that has full node integration doesn't work. And it doesn't work in a big way: it crashes electron. For some reason it crashes when trying to read the source files here:

fs.readFile(filename, function(readErr, file) {
, even though I can read those files fine if I do fs.readFile somewhere else in my code in the renderer process.

My files aren't sourcemapped, so by using raven-js, I won't get any source info in sentry. There's zero way for me to get it work. Since my files aren't sourcemapped, I can't upload a sourcemap. But since raven-node doesn't work, I have to use raven-js which expects sourcemaps.

Do you want to request a feature or report a bug? Sort of both

Has someone had this problem before? I could not find anything

(using latest version of raven-node)

@jlongster
Copy link
Author

I found out another approach for running my node backend that may solve this. Supposedly you can fork the electron process which creates a standalone node process which is what I want, and would solve all the issues like this one (I could use raven-node like normal). I expect to hit issues but hopefully it works smoothly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant