Skip to content

Conversation

@andreiborza
Copy link
Member

Closes: #18516

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

We might need to re-export it manually from some meta framework packages if the consistent exports e2e test fails

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.

contextLinesIntegration(),
nodeContextIntegration(),
modulesIntegration(),
processSessionIntegration(),
Copy link

Choose a reason for hiding this comment

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

Missing tests for new Bun integration feature

Low Severity · Bugbot Rules

This is a feat PR that adds processSessionIntegration to Bun's default integrations, but doesn't include any integration or E2E tests. Per the review rules file, feat PRs are expected to include at least one integration or E2E test. The existing test file packages/bun/test/init.test.ts tests integration setup patterns and could be extended to verify ProcessSession is included in the default integrations when initializing the Bun SDK.

Fix in Cursor Fix in Web

@github-actions
Copy link
Contributor

github-actions bot commented Jan 16, 2026

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 8,583 - 9,330 -8%
GET With Sentry 1,611 19% 1,710 -6%
GET With Sentry (error only) 5,847 68% 5,930 -1%
POST Baseline 1,164 - 1,204 -3%
POST With Sentry 567 49% 595 -5%
POST With Sentry (error only) 1,012 87% 1,051 -4%
MYSQL Baseline 3,160 - 3,209 -2%
MYSQL With Sentry 362 11% 482 -25%
MYSQL With Sentry (error only) 2,538 80% 2,619 -3%

View base workflow run

Copy link
Member

@s1gr1d s1gr1d left a comment

Choose a reason for hiding this comment

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

Nice, thank you!

I tested this locally and Bun now shows failure rates and crash free sessions 🎉

Image

@github-actions
Copy link
Contributor

github-actions bot commented Jan 16, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 25.11 kB - -
@sentry/browser - with treeshaking flags 23.61 kB - -
@sentry/browser (incl. Tracing) 41.86 kB - -
@sentry/browser (incl. Tracing, Profiling) 46.45 kB - -
@sentry/browser (incl. Tracing, Replay) 80.46 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 70.15 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 85.17 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 97.36 kB - -
@sentry/browser (incl. Feedback) 41.83 kB - -
@sentry/browser (incl. sendFeedback) 29.79 kB - -
@sentry/browser (incl. FeedbackAsync) 34.79 kB - -
@sentry/browser (incl. Metrics) 26.21 kB - -
@sentry/browser (incl. Logs) 26.37 kB - -
@sentry/browser (incl. Metrics & Logs) 27.02 kB - -
@sentry/react 26.84 kB - -
@sentry/react (incl. Tracing) 44.08 kB - -
@sentry/vue 29.56 kB - -
@sentry/vue (incl. Tracing) 43.67 kB - -
@sentry/svelte 25.12 kB - -
CDN Bundle 27.61 kB - -
CDN Bundle (incl. Tracing) 42.59 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 43.5 kB - -
CDN Bundle (incl. Tracing, Replay) 79.29 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 84.71 kB - -
CDN Bundle - uncompressed 80.89 kB - -
CDN Bundle (incl. Tracing) - uncompressed 126.3 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 129.32 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 242.84 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 255.63 kB - -
@sentry/nextjs (client) 46.43 kB - -
@sentry/sveltekit (client) 42.24 kB - -
@sentry/node-core 51.91 kB - -
@sentry/node 162.16 kB - -
@sentry/node - without tracing 93.33 kB +0.01% +1 B 🔺
@sentry/aws-serverless 108.83 kB - -

View base workflow run

contextLinesIntegration(),
nodeContextIntegration(),
modulesIntegration(),
processSessionIntegration(),
Copy link

Choose a reason for hiding this comment

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

Bug: The processSessionIntegration is added to Bun's default integrations but will not work with Bun.serve() because the beforeExit event it relies on never fires.
Severity: HIGH

Suggested Fix

Conditionally exclude processSessionIntegration from the default integrations when the SDK is used in a Bun environment, or implement an alternative mechanism to end sessions that is compatible with Bun's lifecycle, such as using the bunServerIntegration to hook into the server's shutdown process.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: packages/bun/src/sdk.ts#L51

Potential issue: The `processSessionIntegration` is being added to the default
integrations for the Bun SDK. This integration relies on the Node.js
`process.on('beforeExit')` event to correctly terminate sessions. However, in Bun
environments using `Bun.serve()`, the `beforeExit` event is never fired. As a result,
for any Bun application utilizing the standard web server, Sentry sessions will not be
properly closed, leading to inaccurate session health and release health metrics. The
integration lacks a fallback mechanism for environments where `beforeExit` is not
supported.

Did we get this right? 👍 / 👎 to inform future reviews.

@andreiborza andreiborza merged commit 6c655db into develop Jan 16, 2026
209 checks passed
@andreiborza andreiborza deleted the ab/bun-process-session-integration branch January 16, 2026 13:16
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.

Bun projects unable to have release health

4 participants