Source maps in electron renderer process

I’m using raven-js in the renderer process of an Electron app, and uploading the source maps via a sentry webpack plugin.

My compiled code is in bundle.js, and the full path is dependent on the OS/user. for example:

<os specific path to app files>/resources/app.asar/dist/bundle.js

The last line of my bundle.js reads:

// # sourceMappingURL=bundle.js.map

In my Sentry dashboard, the release has the following artifacts:

~/bundle.js
~/bundle.js.map

However, when an error throws, Sentry doesn’t seem to apply source maps (stack trace from sentry dashboard below)

I’ve made this work before in web applications using hosted source maps, so I thought I was configuring everything correctly, but clearly something’s amiss.

Any ideas what might be wrong?

/C:/Users/brand/AppData/Local/Programs/wayhome/resources/app.asar/dist/bundle.js in Object../app/routes.js at line 14023:125
/C:/Users/brand/AppData/Local/Programs/wayhome/resources/app.asar/dist/bundle.js in __webpack_require__ at line 21:30
/C:/Users/brand/AppData/Local/Programs/wayhome/resources/app.asar/dist/bundle.js in Object../app/containers/Root.js at line 9757:304
/C:/Users/brand/AppData/Local/Programs/wayhome/resources/app.asar/dist/bundle.js in __webpack_require__ at line 21:30
/C:/Users/brand/AppData/Local/Programs/wayhome/resources/app.asar/dist/bundle.js in Object../app/index.js at line 9777:509
/C:/Users/brand/AppData/Local/Programs/wayhome/resources/app.asar/dist/bundle.js in __webpack_require__ at line 21:30
/C:/Users/brand/AppData/Local/Programs/wayhome/resources/app.asar/dist/bundle.js in Object.22 at line 222740:18
/C:/Users/brand/AppData/Local/Programs/wayhome/resources/app.asar/dist/bundle.js in __webpack_require__ at line 21:30
/C:/Users/brand/AppData/Local/Programs/wayhome/resources/app.asar/dist/bundle.js in module.exports../app/app-relay-route.js.Object.defineProperty.value at line 64:18
/C:/Users/brand/AppData/Local/Programs/wayhome/resources/app.asar/dist/bundle.js at line 67:10

The ~ prefix today literally only omits protocol, host and port from a URL. We either need to introduce a true wildcard prefix, or you need to use a callback function to normalize your URLs before they’re sent to the Sentry server.

cc @mitsuhiko

thanks @benvinegar , understood re: ~/

as for normalizing the URLs, do you mean normalize the URL of the error event in the dataCallback described in the docs?

Is there a good example I can look at to get a sense of what that step entails?

as for normalizing the URLs, do you mean normalize the URL of the error event in the dataCallback described in the docs?

Normalize the file/URL of each file in the stack trace.

Basically, dataCallback passes a data object has the error payload right before it is sent to Sentry. It adheres to our documented client SDK specification. You can inspect exception interface, locate the frames and modify the file for each one.

Our deprecated react-native plugin has some example code that does this.

@benvinegar i highly recommend to introduce a true wildcard prefix