Sentry-cli: Upload hidden sourcemaps

Created on 5 May 2020  路  7Comments  路  Source: getsentry/sentry-cli

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

Imgur

Seems like sentry is not able to find the .js file. This error is always happening:

Unable to fetch HTTP resource

Imgur

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.

releases need more information

Most helpful comment

Well, I'm really dumb and cannot read apparently. Sorry! 馃槄
Will take a second look in the morning.

All 7 comments

Do you associate the same release with the Sentry.init call from the JS SDK? It seems like your Sentry instance is trying to fetch the files from an external source, instead of a local filesystem, which can indicate that release artifacts are not linked to the event itself.

Are you using on-promise or SaaS version of Sentry? If former, make sure that your file-storage is configured properly https://develop.sentry.dev/services/filestore/

I'm using SaaS version of Sentry. And yes, they are mapped together with release and environment.

Also, it seems like the files are well stored in the release artifacts

Imgur

I'm using SaaS version of Sentry.

As this is an issue with self-hosted instance then, please post this question on https://forum.sentry.io/c/on-premise/7 as it's almost certainly issue with the service itself, not the sentry-cli. Thanks!

Are you using on-promise or SaaS version of Sentry?

There seems to be some miscommunication issues here... I'm not using an on-premise/self-hosted/in-house solution. Just using Sentry.io out of the box solution.

Well, I'm really dumb and cannot read apparently. Sorry! 馃槄
Will take a second look in the morning.

@emanuelpinho can you provide a link to any event that you used to test this? I'll take a look directly. Thanks!

@kamilogorek Thank you very much. Seems like it is working when deployed in production. Some problem when using docker to simulate the prod environment was causing the issue. Closing this.

Was this page helpful?
0 / 5 - 0 ratings