Skip to content

sourcemap: handle inline base64 sourcemaps in inject/upload #1054

@BYK

Description

@BYK

Part of the parity effort tracked in #600.

Goal

Handle inline base64-encoded sourcemaps in sentry sourcemap inject / upload, matching legacy sentry-cli sourcemaps.

Background

The new CLI's sourcemap inject already follows external //# sourceMappingURL=<path> directives (slow-path in src/lib/sourcemap/inject.ts, SOURCE_MAPPING_URL_RE). The remaining gap is inline sourcemaps embedded as data URLs:

//# sourceMappingURL=data:application/json;base64,<...>

Scope

  • Detect data:application/json;...;base64, sourceMappingURL values.
  • Base64-decode, inject the debug ID into the decoded JSON map, re-encode, and rewrite the directive in place.
  • For upload, extract/handle the inline map accordingly.

Critical gotcha (from issue #600 / legacy PR #3243)

Base64 decode failures MUST be non-fatal — warn and skip, never crash. Bundled terser/babel code contains template literals that produce false-positive sourceMappingURL lines.

Effort

Medium (2-3 days).

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions