Sentry trying to fetch sourcemaps from remote URL instead of matching uploaded Artifacts

Hello friends,

We have self hosted Sentry on sentry.[company].com. For our React app, we’d like to get sourcemaps support.

The issue:

We are using sentry-cli tool to upload source files found in build/static/js/ with the following command:

sentry-cli releases files $GIT_SHA upload-sourcemaps build/static/js/ --url-prefix '~/static/js/' --validate

Our static files are hosted in amazon S3 at:
https://example.com/static/js/6.8419741c.chunk.js and contain the following sourceMappingURL:

//# sourceMappingURL=6.8419741c.chunk.js.map

We remove the .map files before uploading our bundle to S3 and instead upload to Sentry with the following --url-prefix: ~/static/js/

Although it seems to be the case that Sentry is still trying to fetch the sourcemaps from the Internet - it’s looking for them at https://example.com/static/js/6.8419741c.chunk.js.map instead of looking in the Artifacts for that release.

What we’ve tried so far:

  1. We tried a variety of --url-prefix values. e.g:
    --url-prefix "~/static/js/",
    --url-prefix "/static/js/"
    --url-prefix "~"
    --url-prefix "~/"
  2. We tried only uploading .map files to Sentry without original .js files.

Unfortunately, even when the paths are exact match, Sentry is still trying to fetch them from a remote URL instead of Artifacts.

We’ve spent quite some time and energy on this, including reading docs, github issues and the forum and tried out solutions that worked for some people (e.g. JavaScript SourceMap is not used).

But still no luck :confused:

We’d really appreciate any help at this point!

Thank you!

2 Likes

One thing is to double-check that the release ID ($GIT_SHA) you specify when uploading the source maps exactly matches what you pass as the release value in your call to Sentry.init at runtime. Sentry uses the release ID ($GIT_SHA, in your case) to match a given event to the correct source maps for that release. If the event shows “Release: n/a”, that means Sentry could not find a matching release for that event (and source maps are tied to releases), and so source mapping won’t work for those events.

Also, you can double-check that the releases are getting created correctly in Sentry for your project via the “Releases” tab on your Sentry project page.

You can also explicitly disallow source fetching through a setting.