Commit 1d1b9d9
fix(inject): Skip non-base64 embedded sourcemaps (#3243)
When you bundle tools like terser or babel into a single JS file (common
in browser-based IDEs or bundler workers), their minified code contains
template literals that build `//#
sourceMappingURL=data:application/json;base64,...` strings as output.
After minification, these can land at the start of a line, and
`discover_sourcemaps_location` treats them as real sourcemap directives.
The problem is the "base64" payload is actually just more JS code, so
decoding fails and `sourcemaps inject` bails with `Invalid embedded
sourcemap`, stopping the whole injection.
This changes the `bail!` to a `warn!` + `continue`, which matches how
the injection flow already handles other non-fatal cases like missing
sourcemaps, ambiguous paths, and unfound files. The file gets skipped
and everything else processes normally.
Includes a test with a minimal fixture that reproduces the issue.
### Issues
#3244
### Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated
in the State of Delaware in 2015 as Functional Software, Inc. and is
gonna need some rights from me in order to utilize my contributions in
this here PR. So here's the deal: I retain all rights, title and
interest in and to my contributions, and by keeping this boilerplate
intact I confirm that Sentry can use, modify, copy, and redistribute my
contributions, under Sentry's choice of terms.
---------
Co-authored-by: Sebastian Zivota <loewenheim@mailbox.org>1 parent 06cbbda commit 1d1b9d9
File tree
4 files changed
+40
-1
lines changed- src/utils
- tests/integration
- _fixtures/inject_sourcemap_in_string_literal
- sourcemaps
4 files changed
+40
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
790 | 790 | | |
791 | 791 | | |
792 | 792 | | |
793 | | - | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
794 | 799 | | |
795 | 800 | | |
796 | 801 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
244 | 267 | | |
245 | 268 | | |
246 | 269 | | |
| |||
0 commit comments