Skip to content

Commit eba6186

Browse files
committed
fix
1 parent cda341c commit eba6186

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • packages/node/src/integrations/fs

packages/node/src/integrations/fs/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ export const fsIntegration = defineIntegration((options: FsInstrumentationConfig
1717
return {
1818
name: INTEGRATION_NAME,
1919
setupOnce() {
20-
enableFsInstrumentation(options);
20+
// We only run this in the next tick to avoid instrumenting the `fs` module while the SDK is initializating
21+
// especially, at the point when this runs the Async Context Manager may not be set up yet,
22+
// which could lead to weird outcomes - so we wait until everything is settled before we instrument.
23+
setImmediate(() => enableFsInstrumentation(options));
2124
},
2225
};
2326
});

0 commit comments

Comments
 (0)