I’m trying to upload sourcemaps generated by webpack to sentry using sentry-cli.
I am getting a couple of different errors but didn’t get what the cause is.
This is the configuration I am using to build and create hidden source maps. I don’t want them to be available on the browser.
mode: 'production',
devtool: 'hidden-source-map',
target: 'web',
entry: { app: PATHS.app },
output: {
path: path.join(__dirname, 'build'),
devtoolModuleFilenameTemplate: '[absolute-resource-path]',
publicPath: '/',
chunkFilename: '[name].[hash].min.js',
filename: '[name].[hash].min.js',
sourceMapFilename: '[name].[hash].min.js.map'
},
Seems like the generated files are being created correctly since I can serve them without any problem (docker). Here an example of how a .map looks like:
{"version":3,"sources":["30.hash.min.js"],"names":["window","push","k++v","module","exports","JSON","parse"],"mappings":"whatever","file":"30.hash.min.js","sourceRoot":""}
I’ve just ended up adding this configuration devtoolModuleFilenameTemplate: '[absolute-resource-path]',
to webpack in order to remove the webpack///
from .map source property.
I’ve already tested many different ways of uploading those files to sentry:
sentry-cli releases -o x -p y files testing upload-sourcemaps build/ --url-prefix "~/" --rewrite
Seems like sentry is not able to find the .js
file. This error is always happening:
Unable to fetch HTTP resource
I’ve also tried multiple different options, playing around with --no-sourcemap-reference
and with --url-prefix
. Sometimes the error above seems to be fixed, but the sourcemap cannot be found anyway.