Skip to content

fix(node-core): Guard against undefined util.getSystemErrorMap#20660

Merged
JPeer264 merged 3 commits intodevelopfrom
seer/fix/node-core-bun-compat
May 11, 2026
Merged

fix(node-core): Guard against undefined util.getSystemErrorMap#20660
JPeer264 merged 3 commits intodevelopfrom
seer/fix/node-core-bun-compat

Conversation

@sentry
Copy link
Copy Markdown
Contributor

@sentry sentry Bot commented May 4, 2026

The systemErrorIntegration in @sentry/node-core attempts to call util.getSystemErrorMap() to determine if an error is a Node.js SystemError. However, in environments like Bun (which provides a Node.js compatibility layer), util.getSystemErrorMap may be undefined.

This leads to a TypeError: util.getSystemErrorMap is not a function when Sentry tries to process any event, effectively crashing the Sentry event pipeline.

This change adds a typeof check for util.getSystemErrorMap within the isSystemError function. If the function is not available, isSystemError will now gracefully return false, preventing the TypeError and allowing Sentry's event processing to continue. This means that system error context enrichment will be skipped in environments where this specific util API is missing, which is the desired fallback behavior.

See also: oven-sh/bun#22872

Fixes XCODEBUILDMCP-1J

@chromy chromy marked this pull request as ready for review May 4, 2026 19:29
@chromy chromy requested a review from a team as a code owner May 4, 2026 19:29
Comment thread packages/node-core/src/integrations/systemError.ts
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 26.3 kB - -
@sentry/browser - with treeshaking flags 24.78 kB - -
@sentry/browser (incl. Tracing) 44.17 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 46.39 kB - -
@sentry/browser (incl. Tracing, Profiling) 49.14 kB - -
@sentry/browser (incl. Tracing, Replay) 83.82 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 73.29 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 88.51 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 101.13 kB - -
@sentry/browser (incl. Feedback) 43.44 kB - -
@sentry/browser (incl. sendFeedback) 31.11 kB - -
@sentry/browser (incl. FeedbackAsync) 36.19 kB - -
@sentry/browser (incl. Metrics) 27.6 kB - -
@sentry/browser (incl. Logs) 27.73 kB - -
@sentry/browser (incl. Metrics & Logs) 28.43 kB - -
@sentry/react 28.04 kB - -
@sentry/react (incl. Tracing) 46.4 kB - -
@sentry/vue 31.18 kB - -
@sentry/vue (incl. Tracing) 46.02 kB - -
@sentry/svelte 26.32 kB - -
CDN Bundle 28.9 kB - -
CDN Bundle (incl. Tracing) 46.94 kB - -
CDN Bundle (incl. Logs, Metrics) 30.33 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 48.03 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 69.64 kB - -
CDN Bundle (incl. Tracing, Replay) 84.32 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 85.4 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 90.12 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 91.22 kB - -
CDN Bundle - uncompressed 84.88 kB - -
CDN Bundle (incl. Tracing) - uncompressed 140.44 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 89.08 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 143.9 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 213.9 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 259.15 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 262.6 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 272.85 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 276.29 kB - -
@sentry/nextjs (client) 48.9 kB - -
@sentry/sveltekit (client) 44.64 kB - -
@sentry/node-core 60.48 kB +0.02% +11 B 🔺
@sentry/node 165.52 kB +0.01% +15 B 🔺
@sentry/node - without tracing 73.5 kB +0.03% +17 B 🔺
@sentry/aws-serverless 107.64 kB +0.01% +10 B 🔺
@sentry/cloudflare (withSentry) - minified 169.37 kB - -
@sentry/cloudflare (withSentry) 427.59 kB - -

View base workflow run

Copy link
Copy Markdown
Member

@nicohrubec nicohrubec left a comment

Choose a reason for hiding this comment

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

Change lgtm! I agree with cursor that a small test would be good to catch future regressions, but else I think this is good to merge from my side.

Comment thread packages/node-core/src/integrations/systemError.ts
Copy link
Copy Markdown

@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.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5d6a696. Configure here.

Comment thread packages/node-core/test/integrations/systemError.test.ts Outdated
@JPeer264 JPeer264 self-assigned this May 11, 2026
Copy link
Copy Markdown
Member

@JPeer264 JPeer264 left a comment

Choose a reason for hiding this comment

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

There is always the small line between adding a workaround on our side or implementing this in the main runtime. Since it is only 3 lines I think it is ok to add this workaround. I added a comment for the origin of the if

@JPeer264 JPeer264 force-pushed the seer/fix/node-core-bun-compat branch from 6752954 to 642d312 Compare May 11, 2026 09:35
@JPeer264 JPeer264 merged commit aac924e into develop May 11, 2026
367 of 369 checks passed
@JPeer264 JPeer264 deleted the seer/fix/node-core-bun-compat branch May 11, 2026 11:42
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.

3 participants