Skip to content

Uploaded source-map artifacts not working without sourceMappingURL commentΒ #20916

@Fonger

Description

@Fonger

Important Details

How are you running Sentry?
Saas (sentry.io)

Description

We're using sentry with sentry-cli to manually upload source maps.

Steps to Reproduce

  1. Generate source maps (with #sourceMappingURL comments)
  2. Upload source map with sentry-cli (artifact)
    sentry-cli upload-sourcemaps --ext map --url-prefix xxxx --rewrite
  3. Remove all *.map in production release.
  4. Remove all #sourceMappingURL comments in *.js
    find '.next' -type f \( -iname \*.js -o -iname \*.css \) -exec sed -i -E 's/\/(\/|\*)# sourceMappingURL=[^ ]*\.(js|css)\.map(\*\/)?//' {} +

What you expected to happen

The error should still report with source map without sourceMappingURL comment.
(note: I can see the correct artifacts uploaded in sentry admin console )

I can confirm it works perfectly without step 4.

Possible Solution

The reason we want to strip the comment is that the browser will throw 404 warning when we open the console by default (chrome and safari) because we explicitly remove all *.map files on our actual server.

We want to console.log() some hiring information there but there're many *.map 404 warnings obstructing the information.
I google for a while and find SourceMap HTTP response header but it is not what we want. If browser see the header it will try to fetch the source map file and get 404 error.

It should work without the comment. ( like hidden-source-map? )

Metadata

Metadata

Assignees

No fields configured for issues without a type.

Projects

Status

No status

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions