Sourcemaps and Electron

Hey guys,

I’m trying to get Sentry working nicely with an Electron application I maintain and so far all is going well. Errors are being sent through and it’s coming through with all the extras I set.

However, the code in my app is minified and transpiled so I need to upload my sourcemaps to make the error traces readable. However, as it is an Electron application the “url” of each file changes from install to install.

This is because the url is the local file system path which changes based on the user’s drive letter config and the user’s username itself.

As such I don’t believe Sentry is correctly identifying how to use the sourcemaps I uploaded. Is there any way to provide the “–url-prefix” as a glob or a wildcard so that I can match a error path like this

“C:\Users\Samuel\AppData\GPMDP_3\app-4.0.0\app.asar\thing.js”

to a prefix like this

“*\app.asar” with a file path of “thing.js”

Right now you have to use the dataCallback and mutate the filenames to be something semi-uniform. You may want to take a look at the react-native plugin in the raven-js source as it does this. Our goal is to remove this requirement and parse it on the server:

So if I use dataCallback and mutate the filenames to all start with app.asar for instance. If I upload my sourceMaps with the URL prefix of app.asar will Sentry correctly use the sourcemaps?

Yep that’s correct. You should just need the input filenames to be static, and then the server can take it from there as long as the uploaded artifacts match those names.

So I got dataCallback all set up and it is mutating the filename correctly (the raw JSON looks good) but it is no longer sending the pre_context, and line_context properties on the exception frame objects.

It doesn’t seem to think (once I mutate the path) that the file is “in_app” any more so it doesn’t send any JS code.

Any thoughts?
(Thanks for all your help so far) :slight_smile:

It doesn’t seem to think (once I mutate the path) that the file is “in_app” any more so it doesn’t send any JS code.

Even if it isn’t in_app, we’d still attach pre/post context.

but it is no longer sending the pre_context, and line_context properties on the exception frame objects

Raven.js no longer pulls context from client-side JavaScript. It’s added by the server from source files/maps it locates either via HTTP or from your artifacts.

What version of Raven.js are you using?

"dependencies": {
  ...
  "raven": "^0.12.1",
  ...
}

Okay, so you’re using raven-node (not raven-js). Is that intentional? (I haven’t experimented with Electron yet, so bear with me a little bit here.)

Yeah. Basically Electron has two types of processes. Main and Renderer. At a high level the main process is basically a node process (like what you’d run on a server) and the Renderer processes and mini browsers (like a chrome tab). So the main process should use raven-node and the Renderer processes should use raven-js.