forked from othiym23/node-continuation-local-storage
-
Notifications
You must be signed in to change notification settings - Fork 90
Open
Description
See title. Execute the following repro code with and without debugger:
import {createNamespace} from 'cls-hooked';
const namespace = createNamespace('test-context');
async function fn() {
namespace.set('test', 'test value');
console.log('Before await: ' + namespace.get('test'));
await Promise.resolve();
console.log('After await: ' + namespace.get('test'));
}
namespace.run(fn);
Without debugger:
Before await: test value
After await: test value
With debugger:
Debugger listening on ws://127.0.0.1:63820/0bbb8cb0-cefc-49b4-bccf-6f16b9cc4d1c
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Before await: test value
After await: undefined
Waiting for the debugger to disconnect...
Tested on Node v18.7.0 and WebStorm 2022.2.1 (shouldn't make a difference but still).
My guess is that the debugger is also using async_hooks and they're somehow conflicting.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels