-
-
Notifications
You must be signed in to change notification settings - Fork 242
Description
Environment
- @angular/core:
15.2.8 - @ionic/core:
6.7.4 - @capacitor/core:
4.7.3 - @sentry/capacitor:
0.14.0 - @sentry/cli:
2.21.2 - @sentry/angular-ivy:
7.73.0 - OS: MacOS Sonoma
14.0
The issue wasn't present in version v2.19.4 of sentry-cli but appeared starting from v2.20.0.
Steps to Reproduce
- Build the app for production. After the build, the generated
.js.maphas the following structure:
{
"version": 3,
"file": "7442.5a96e681b5941655.js",
"sources": [
"./libs/boldor/common/src/lib/pages/debug-page/debug-page.component.html",
"./libs/boldor/common/src/lib/pages/debug-page/debug-page.component.ts"
],
"sourceRoot": "webpack:///",
"sourcesContent": [/*...*/],
"names": [/*...*/],
"mappings": "..."
}- Inject the build using the sentry-cli:
sentry-cli sourcemaps inject --org ... --project ... PATH/www
Expected Result
I expected the injected .js.map to retain the original "sources" values, with just the debug_id added.
Actual Result
After injecting with sentry-cli, the .js.map transforms to:
{
"version": 3,
"file": "7442.5a96e681b5941655.js",
"sources": [
"webpack:///./libs/boldor/common/src/lib/pages/debug-page/debug-page.component.html",
"webpack:///./libs/boldor/common/src/lib/pages/debug-page/debug-page.component.ts"
],
"sourceRoot": "webpack:///",
"sourcesContent": [/*...*/],
"names": [/*...*/],
"mappings": "...",
"debug_id": "..."
}The "sourceRoot" value (webpack:///) is prepended to every entry in the "sources", preventing the sourcemaps from being correctly applied in the stacktraces on the Sentry web dashboard.
Additionally:
After uploading the sourcemap with sentry-cli, the .js.map further transforms to:
{
"version": 3,
"file": "7442.5a96e681b5941655.js",
"sources": [
"webpack:///webpack:///./libs/boldor/common/src/lib/pages/debug-page/debug-page.component.html",
"webpack:///webpack:///./libs/boldor/common/src/lib/pages/debug-page/debug-page.component.ts"
],
"sourceRoot": "webpack:///",
"sourcesContent": [/*...*/],
"names": [/*...*/],
"mappings": "...",
"debug_id": "..."
}There is twice webpack:/// in "sources". But it seems not adding again webpack:/// with --no-rewrite option.
I suspect there might be some misbehaving replacement code introduced in v2.20.0.
Note: Uploading sourcemaps via @sentry/webpack-plugin doesn't result in these issues. However, due to technical reasons, we prefer uploading sourcemaps through sentry-cli.
I don't understand why during sourcemaps upload command, on artifacts uploaded on Sentry UI, sourceRoot is removed and appended to each sources values. It break our stacktrace-sourcemap mapping on Sentry UI.
With @sentry/webpack-plugin, sourcemaps locally generated are same than uploaded :
{
"version": 3,
"file": "7442.1336249b14eae724.js",
"mappings": "...",
"names": [...],
"sourceRoot": "webpack:///",
"sources": [
"libs/boldor/common/src/lib/pages/debug-page/debug-page.component.html",
"libs/boldor/common/src/lib/pages/debug-page/debug-page.component.ts"
],
"sourcesContent": [...],
"x_google_ignoreList": [],
"debug_id": "7ce5819d-f3f1-420b-9134-ec57528d4a80",
"debugId": "7ce5819d-f3f1-420b-9134-ec57528d4a80"
}No any modifications on sources. And it works like a charm!