Commit graph

2 commits

Author SHA1 Message Date
Huang Xin
f8d7e2638e
fix(build): strip dangling sourceMappingURL comments from Tauri builds (#5498)
Every Tauri build since 0.11.20 logs a source map parse error per chunk in the
webview console:

  Source Map "tauri://localhost/_next/static/chunks/<hash>.js.map" has
  SyntaxError: JSON Parse error: Unrecognized token '<'

productionBrowserSourceMaps makes Turbopack emit the maps and append a
sourceMappingURL comment to every chunk. upload-sourcemaps.mjs uploads the maps
to Sentry and deletes them, but left the comments behind, so devtools requested
the missing maps (204 of 210 chunks) and got the asset protocol's HTML back.

- upload-sourcemaps.mjs: strip the comment alongside the map. Turbopack names a
  map after a different hash than the chunk pointing at it, so every chunk under
  the directory is rewritten rather than paired by name. The sentry-cli debugId
  comment is preserved, since Sentry matches uploaded maps by it.
- KEEP_SOURCEMAPS=1 keeps the maps in the bundle instead. dev-ios, dev-android
  and the new dev-macos set it, so local devtools resolve minified frames to
  real sources.
- Move the script body behind a main guard so the helpers are importable, and
  unit test them.

Symbolication is unaffected: the strip still runs after the upload, so the
copies Sentry holds keep their comments.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 19:01:18 +02:00
Huang Xin
870a62e0e9
feat(sentry): upload browser source maps for symbolicated JS crashes (#5027)
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (rust) (push) Waiting to run
Publish Docker image / build (linux/amd64, ubuntu-latest) (push) Waiting to run
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Publish Docker image / merge (push) Blocked by required conditions
PR checks / rust_lint (push) Waiting to run
PR checks / build_web_app (push) Waiting to run
PR checks / test_web_app (1) (push) Waiting to run
PR checks / test_web_app (2) (push) Waiting to run
PR checks / test_extensions (push) Waiting to run
PR checks / build_tauri_app (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
Production JS crashes report minified chunk names with no source lines, which
blocked triaging most reader/TTS Sentry issues. Generate browser source maps for
the Tauri export build and upload them right after `next build`:

- next.config: productionBrowserSourceMaps for the export build.
- scripts/upload-sourcemaps.mjs: sentry-cli injects debug IDs + uploads the maps
  (release Readest@<version>, ~/_next/static url-prefix), then strips the .map
  files so they never ship in the app bundle. Token-gated; never fails the build.
- CI (release.yml, nightly.yml): pass SENTRY_AUTH_TOKEN / SENTRY_ORG /
  SENTRY_PROJECT alongside SENTRY_DSN.
- docs/sentry-symbolication.md: setup + required secret, and the native
  (Android ProGuard/.so, iOS dSYM) follow-up.

Local and fork builds are unaffected: with no token the maps are stripped and
the output is unchanged. Needs the SENTRY_AUTH_TOKEN GitHub secret to take effect.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 09:18:48 +02:00