Skip to content

sentryBunPlugin should inject debug IDs and upload source maps, like the esbuild plugin #25618

Closed

Description

@Itz-Agasta

Problem Statement

The Bun guide recommends building with sentryBunPlugin from @sentry/bun/plugin, and we do (Bun 1.4.3, @sentry/bun 11.8.0) so pg queries become db spans. But that plugin only runs the orchestrion transform (@sentry/server-utils/orchestrion/bundler/bun.js). Getting readable server stack traces takes a second tool: build with sourcemap: "external", then sentry sourcemap inject and sentry sourcemap upload, plus setting the release ourselves. Without that, errors show frames like dist/index.js:169867 with js_no_source.

The Bun source maps page lists webpack, Rollup, Vite and esbuild under "Sentry Bundler Support", but not Bun, even though Bun is now the bundler the Bun guide tells you to use. The legacy sentry-cli that older docs point to silently skips Bun output (Bun writes its own //# debugId), so the manual path is easy to get wrong.

Solution Brainstorm

Let sentryBunPlugin take the same build options as sentryEsbuildPlugin (org, project, authToken, sourcemaps, release) and, when an auth token is present, inject the debug ID snippet (reusing the ID Bun already emits) and upload the maps at the end of Bun.build. Then add Bun to "Sentry Bundler Support" on the source maps page.

Additional Context

Minimal build:

import { sentryBunPlugin } from "@sentry/bun/plugin";

await Bun.build({
  entrypoints: ["./src/index.ts"],
  outdir: "./dist",
  target: "bun",
  sourcemap: "external",
  plugins: [sentryBunPlugin()],
});

Related: #19707 (Improve Bun Support), getsentry/toolkit#1513 (CLI side of Bun debug IDs, fixed in getsentry/toolkit#1515).

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Activity

  1. linear-code commented on Oct 21, 2026

    @linear-code
  2. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Oct 21, 2026
  3. self-assigned this
    on Oct 22, 2026
  4. removed their assignment
    on Oct 22, 2026
  5. s1gr1d commented on Oct 22, 2026

    @s1gr1d
    Member

    Hi thanks for writing in!
    I added this to our Bun tracking issue, it makes sense to improve this and align with the other plugins. However, we first need to check whether we can upload source maps in the Bun.build run (onEnd).

    Another approach would also be to add a bun adapter like the esbuild one, but that needs further discussion on how we're gonna approach this.

  6. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Oct 22, 2026
  7. self-assigned this
    on Oct 22, 2026
  8. added a commit that references this issue on Oct 23, 2026
    7420fdb
  9. added a commit that references this issue on Oct 23, 2026
    21a9938
  10. github-actions commented on Oct 28, 2026

    @github-actions
    Contributor

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #25670, which was included in the 11.10.0 release.

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

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions