Open jerbob92 opened 1 month ago
@jerbob92 cant really say why it does not work in your case. Here is a an example which is working with my self hosted sentry https://github.com/Akylas/OSS-DocumentScanner/blob/master/app.webpack.config.js#L556
Thanks! I think that did give me some hints, it also seems like I was wrong in what it uploads, it only seems to upload the JS right now, not the source map. I think it's not able to resolve the sourcemaps right now because I have them placed in a different directory, with the sourcemaps option that should be fixed :)
I discovered the following:
sourceMappingURL
is absolutefilesToDeleteAfterUpload
, but for some reason that breaks the plugin (maybe it needs the files after deleting?)So my current solution is:
const sourcemapDir = join(__dirname, `platforms/sourceMap`);
// Write away sourcemaps outside build dir.
const customSourceMapDevToolPluginInstance = new SourceMapDevToolPlugin({
append: `\n//# sourceMappingURL=${sourcemapDir}/[name].js.map`,
filename: '../../../../../../sourceMap/[name].js.map'
});
config.plugin('SourceMapDevToolPlugin').use(customSourceMapDevToolPluginInstance);
And then not setting any assets. This will keep the sourcemap out of the build (will be in platforms/sourceMap
and still allows the plugin to resolve them.
I did notice that the source mapping won't work correctly for captureMessage
, but it does for normal errors.
@jerbob92 if it works for you good. Now I can way in my apps it works as expected even if the sourcemaps are not in the same folder. Not sure what the difference might come from. I using latest sentry self hosted
@farfromrefug but in your linked example it does put the source map in the same dir as the JS, so probably they do end up in the app build. I also use latest self-hosted Sentry.
This is the final issue I'm trying to solve:
Sentry.captureMessage
:
As you can see, this doesn't have the sourcemap, probably because the stack is incorrect?
Capturing exceptions (just a random throw somewhere) with a custom Angular ErrorHandler:
This one has a stack but it has the stack of where I execute Sentry.captureException
. Any idea what I can do to improve this? I would expect it to take the stack of the err
object.
@jerbob92 it must come from the stack "filename" format. hard to say without being in front. But same the sample code i shared works for ios/android so you can look at it. Maybe this could be important too https://github.com/Akylas/OSS-DocumentScanner/blob/master/app/utils/sentry.ts#L17
I followed the readme closely (but had to make changes to make it work in the current NS setup), but I can't get sourcemaps to show up in Sentry. I'm 100% certain the source maps are uploaded (I validated in Sentry), and I'm also 100% sure that the release and dist in the Webpack
sentryWebpackPlugin
match up with what I configure in the plugin.But it still ends up like this in Sentry:
Any idea what I can do here? I also tried with and without rewriting. My webpack looks like this now: