fix(node-core): Guard against undefined util.getSystemErrorMap#20660
fix(node-core): Guard against undefined util.getSystemErrorMap#20660sentry[bot] wants to merge 2 commits intodevelopfrom
Conversation
size-limit report 📦
|
nicohrubec
left a comment
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 5d6a696. Configure here.
| value: originalGetSystemErrorMap, | ||
| configurable: true, | ||
| writable: true, | ||
| }); |
There was a problem hiding this comment.
Test mock redefines module namespace
Medium Severity
util is an ESM module namespace for node:util, whose exports are non-configurable in Vitest’s Node environment. Redefining getSystemErrorMap with Object.defineProperty throws before assertions run, so the new regression tests fail instead of exercising the guard.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 5d6a696. Configure here.


The
systemErrorIntegrationin@sentry/node-coreattempts to callutil.getSystemErrorMap()to determine if an error is a Node.js SystemError. However, in environments like Bun (which provides a Node.js compatibility layer),util.getSystemErrorMapmay be undefined.This leads to a
TypeError: util.getSystemErrorMap is not a functionwhen Sentry tries to process any event, effectively crashing the Sentry event pipeline.This change adds a
typeofcheck forutil.getSystemErrorMapwithin theisSystemErrorfunction. If the function is not available,isSystemErrorwill now gracefully returnfalse, preventing theTypeErrorand allowing Sentry's event processing to continue. This means that system error context enrichment will be skipped in environments where this specificutilAPI is missing, which is the desired fallback behavior.See also: oven-sh/bun#22872
Fixes XCODEBUILDMCP-1J