-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
Fall back to co-located source maps in sourcemaps inject
command
#1846
Comments
Hi, author of getsentry/sentry-javascript#9666 here 👋 I'm going to start working on a PR for this. If someone already has something underway, please let me know. Thanks! One question: if the source file contains an external sourcemap URL and a co-located source map file exists, which one should
|
I think I was under the impression that the CLI would attempt to download the sourcemap if For a js bundle containing this line: //# sourceMappingURL=https://my-s3-bucket.s3.amazonaws.com/static/build/_shared/chunk-GBSSQ3TL.js.map
which would certainly explain the failure to find the source map! 😅 |
I don't think the CLI will download files. It will just look for them locally. If you have "fetching source maps" enabled in Sentry we will also try to grab it from wherever the url points to. |
That's correct, Also note that your notion of "co-location" can be expanded a bit using the sentry-cli/src/utils/sourcemaps/inject.rs Lines 259 to 269 in 791a1f8
|
When a sourceMappingURL is a remote URL (e.g. static storage in an S3 bucket), `sentry-cli sourcemaps inject` was treating it like a normal file path, attempting to "normalize" it with the source path, and producing a bogus url such as `path/to/source/dir/https://some-static-host.example.com/path/to/foo.js.map`, which of course doesn't exist, and thus the sourcemap isn't found and doesn't have the debug id injected - even if it's sitting right there in the local directory, next to its corresponding bundled source file. With this change, the sourcemap discovery step does not attempt to use the discovered sourcemap URL if it is a remote URL. Instead, it falls back to guessing the sourcemap location based on the source filename and its location. Fixes getsentry#1846.
When a sourceMappingURL is a remote URL (e.g. static storage in an S3 bucket), `sentry-cli sourcemaps inject` was treating it like a normal file path, attempting to "normalize" it with the source path, and producing a bogus url such as `path/to/source/dir/https://some-static-host.example.com/path/to/foo.js.map`, which of course doesn't exist, and thus the sourcemap isn't found and doesn't have the debug id injected - even if it's sitting right there in the local directory, next to its corresponding bundled source file. With this change, the sourcemap discovery step does not attempt to use the discovered sourcemap URL if it is a remote URL. Instead, it falls back to guessing the sourcemap location based on the source filename and its location. I also changed a couple trycmd tests to remove the `+` before the timezone offset, as it causes the tests to fail when the local timezone is west of UTC. Fixes getsentry#1846.
When a sourceMappingURL is a remote URL (e.g. static storage in an S3 bucket), `sentry-cli sourcemaps inject` was treating it like a normal file path, attempting to "normalize" it with the source path, and producing a bogus url such as `path/to/source/dir/https://some-static-host.example.com/path/to/foo.js.map`, which of course doesn't exist, and thus the sourcemap isn't found and doesn't have the debug id injected - even if it's sitting right there in the local directory, next to its corresponding bundled source file. With this change, the sourcemap discovery step does not attempt to use the discovered sourcemap URL if it is a remote URL. Instead, it falls back to guessing the sourcemap location based on the source filename and its location. I also changed a couple trycmd tests to remove the `+` before the timezone offset, as it causes the tests to fail when the local timezone is west of UTC. Fixes getsentry#1846.
Hmm, it seems that this issue also occurs if the @lforst Better to create a new issue, or reopen this one? |
@brettdh Please open a new issue with exact steps to reproduce what is wrong. Thanks! |
Based on the feedback in getsentry/sentry-javascript#9666 the CLI should fall back to looking for a generated file's source map in the colocated location when
sourceMapURL
commentsourceMapURL
comment points to.An example of "co-location":
The text was updated successfully, but these errors were encountered: