Skip to content

fix(telemetry): enable sourcemap resolution in Sentry#144

Merged
BYK merged 2 commits intomainfrom
fix/sourcemap-resolution
Jan 31, 2026
Merged

fix(telemetry): enable sourcemap resolution in Sentry#144
BYK merged 2 commits intomainfrom
fix/sourcemap-resolution

Conversation

@BYK
Copy link
Member

@BYK BYK commented Jan 31, 2026

Summary

Sourcemaps were being uploaded to Sentry but stack traces still showed minified code (e.g., t.with, br, bin.cjs:486:1136).

Root cause: The beforeSend path normalization was modifying stack frame filenames (replacing /home/user with ~), which broke Sentry's ability to match frames against the uploaded sourcemaps via debug IDs.

Changes

  • Remove path normalization in beforeSend that broke sourcemap matching
  • Replace @sentry/esbuild-plugin with sentry-cli commands for more reliable debug ID injection
  • Keep default SDK integrations (filtering instead of disabling all) to preserve debug ID support

Before

at t.with (~/.../dist/bin.cjs:28:108124)
at br (~/.../dist/bin.cjs:40:4319)
at <unknown> (~/.../dist/bin.cjs:486:1136)

After

../src/bin.ts:14:13 (callback)
    throw new Error("Sourcemap test error from bin.ts");
../src/lib/telemetry.ts:79:24 (callback)
    return await callback(span);

@github-actions
Copy link
Contributor

github-actions bot commented Jan 31, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Bug Fixes 🐛

  • (telemetry) Enable sourcemap resolution in Sentry by BYK in #144

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 31, 2026

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 1779 uncovered lines.
❌ Project coverage is 69.98%. Comparing base (base) to head (head).

Files with missing lines (24)
File Patch % Lines
human.ts 31.87% ⚠️ 682 Missing
resolve-target.ts 20.82% ⚠️ 251 Missing
oauth.ts 25.39% ⚠️ 191 Missing
api-client.ts 71.60% ⚠️ 146 Missing
resolver.ts 3.23% ⚠️ 120 Missing
errors.ts 5.94% ⚠️ 95 Missing
migration.ts 47.44% ⚠️ 82 Missing
api.ts 89.80% ⚠️ 47 Missing
seer.ts 75.54% ⚠️ 45 Missing
seer.ts 79.87% ⚠️ 30 Missing
preload.ts 39.02% ⚠️ 25 Missing
detector.ts 87.79% ⚠️ 16 Missing
schema.ts 64.10% ⚠️ 14 Missing
auth.ts 94.78% ⚠️ 7 Missing
utils.ts 97.59% ⚠️ 4 Missing
index.ts 95.06% ⚠️ 4 Missing
colors.ts 91.84% ⚠️ 4 Missing
telemetry.ts 97.16% ⚠️ 4 Missing
env-file.ts 97.17% ⚠️ 3 Missing
sentry-urls.ts 82.35% ⚠️ 3 Missing
alias.ts 98.56% ⚠️ 2 Missing
project-aliases.ts 97.40% ⚠️ 2 Missing
java.ts 97.22% ⚠️ 1 Missing
parser.ts 98.63% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    70.01%    69.98%    -0.03%
==========================================
  Files           51        51         —
  Lines         5932      5926        -6
  Branches         0         0         —
==========================================
+ Hits          4153      4147        -6
- Misses        1779      1779         —
- Partials         0         0         —

Generated by Codecov Action

Sourcemaps were being uploaded but stack traces still showed minified code.

Root cause: The path normalization in beforeSend was modifying stack frame
filenames (replacing /home/user with ~), which broke Sentry's ability to
match frames against the uploaded sourcemaps via debug IDs.

Changes:
- Remove path normalization that broke sourcemap matching
- Keep default SDK integrations (including Context) instead of disabling all
- Remove redundant manual tags now that Context integration handles them
@BYK BYK force-pushed the fix/sourcemap-resolution branch from 95e57fb to 2b8b144 Compare January 31, 2026 03:49
@BYK BYK marked this pull request as ready for review January 31, 2026 03:50
@BYK BYK merged commit a0cbbf9 into main Jan 31, 2026
12 checks passed
@BYK BYK deleted the fix/sourcemap-resolution branch January 31, 2026 03:57
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

// This is CLI-specific context not provided by the Context integration
const runtime =
typeof process.versions.bun !== "undefined" ? "bun" : "node";
Sentry.setTag("runtime", runtime);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Telemetry tags removed, breaking searchability in Sentry

Low Severity

The platform, arch, runtime, and runtime.version tags were removed, with only cli.runtime remaining. The comment suggests the Context integration handles the rest, but the Context integration adds this data to the event's contexts object (not indexed), not as searchable tags. Any existing Sentry dashboards, alerts, or saved searches filtering by these tags would no longer work. Additionally, runtime was renamed to cli.runtime, which is a breaking change for existing queries.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant