You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fsIntegration crashes in native ESM when patching the read-only fs namespace #25950
Run with node --input-type=module (or save as .mjs). The same failure occurs when registering fsIntegration() through Sentry.init().
Actual behavior
The process throws asynchronously:
TypeError: Cannot assign to read only property 'accessSync' of object '[object Module]'
The stack points to _patchMethod in build/esm/integrations/fs/vendored/instrumentation.js.
Expected behavior
Filesystem instrumentation initializes in native ESM without crashing.
Cause and workaround
The ESM implementation imports * as fs from 'fs' and then assigns wrappers to that read-only module namespace. Loading the integration from the public CommonJS build with createRequire() works. Using the mutable default fs export fixes the crash; calling syncBuiltinESMExports() afterward also refreshes named ESM bindings.
I'd like to submit a small fix: use the mutable default fs export and refresh named ESM bindings with syncBuiltinESMExports().
The existing filesystem integration tests currently run only in CommonJS; I'd extend coverage to native ESM, including named imports. I've verified the fix locally.
Would you be happy for me to open a draft PR against develop?
Activity
linear-code commentedon Oct 30, 2026
JS-4048
utrumo commentedon Oct 30, 2026
I'd like to submit a small fix: use the mutable default
fsexport and refresh named ESM bindings withsyncBuiltinESMExports().The existing filesystem integration tests currently run only in CommonJS; I'd extend coverage to native ESM, including named imports. I've verified the fix locally.
Would you be happy for me to open a draft PR against
develop?