Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upload-sourcemaps fails when setting --url-prefix with hidden source maps #894

Closed
sman591 opened this issue Jan 27, 2021 · 3 comments
Closed

Comments

@sman591
Copy link
Contributor

sman591 commented Jan 27, 2021

Environment

How do you use Sentry?

  • Sentry SaaS (sentry.io

Which SDK and version?

sentry-cli 1.61.0

Steps to Reproduce

  1. Generate a Webpack bundle with devtool: "hidden-source-map" to the folder generated_assets/
  2. Run sentry-cli:
    sentry-cli releases files 1.2.3 upload-sourcemaps generated_assets/ --url-prefix /assets/generated_assets/ --wait --validate
    

Expected Result

  • Source maps are auto-detected, linked together, pass validation, and successfully uploaded
  • Source maps are working when viewing stack traces on Sentry.io

Actual Result

  • --validate fails validation
  • Omitting --validate renders the source maps on Sentry.io useless (it can't find them / doesn't un-minify the stack traces)

Sentry CLI output (abbreviating for fewer files + exact file names):

> Found 404 release files
> Analyzing 404 sources
[...]
> Rewriting sources
[...]
> Adding source map references
> Validating sources
[...]

Source Map Validation Report
  Scripts
[...]
  Minified Scripts
    /assets/generated_assets/File-1234.chunk.js (sourcemap at File-1234.chunk.js.map)
      - error: failed to process: relative URL without a base
  Source Maps
    /assets/generated_assets/File-1234.chunk.js.map
error: Encountered problems when validating source maps.
@sman591
Copy link
Contributor Author

sman591 commented Jan 27, 2021

Update: I was able to fix this by using a ~ in my URL Prefix / url_prefix:

Before

sentry-cli releases files 1.2.3 upload-sourcemaps generated_assets/ \
  --url-prefix /assets/generated_assets/ \
  --wait --validate

After -- which now works:

sentry-cli releases files 1.2.3 upload-sourcemaps generated_assets/ \
  --url-prefix ~/assets/generated_assets/ \
   --wait --validate

I'll leave this open though for a Sentry maintainer to look at. This wasn't previously the case ~1 year ago -- is this expected?

@kamilogorek
Copy link
Contributor

This is expected behavior, as ~/ is wildcard matcher for any protocol+host pair.

ref: https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js/#using-sentry-cli
ref: https://docs.sentry.io/product/cli/releases/#sentry-cli-sourcemaps

@krutoo
Copy link

krutoo commented Jan 23, 2023

Update: I was able to fix this by using a ~ in my URL Prefix / url_prefix:

Before

sentry-cli releases files 1.2.3 upload-sourcemaps generated_assets/ \
  --url-prefix /assets/generated_assets/ \
  --wait --validate

After -- which now works:

sentry-cli releases files 1.2.3 upload-sourcemaps generated_assets/ \
  --url-prefix ~/assets/generated_assets/ \
   --wait --validate

I'll leave this open though for a Sentry maintainer to look at. This wasn't previously the case ~1 year ago -- is this expected?

@sman591 Thank you so mush, i just add ~ to start of urlPrefix and Sentry now sees source maps and thinks that source maps are correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants