-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Description
🐛 Bug Report
See https://github.com/stephenh/async-local-storage-repro, DataDog/dd-trace-js#1095, fastify/fastify-request-context#49, or try running tests from https://github.com/puzpuzpuz/cls-rtracer with Node 16.2.0
Change in 16.2.0 that is causing this: nodejs/node#36394
More detailed analysis on the root cause for the issue: nodejs/node#38781
To Reproduce
If you run code that does:
- access AsyncLocalStorage.getStore
- await a promise
- access AsyncLocalStorage.getStore again, on node 16.2.0 and jest,
the getStore value is lost and comes back as undefined.
Expected behavior
AsyncLocalStorage should work as it did on previous versions with Node 16.2.0 and Jest, returning previously set value
Link to repl or repo (highly encouraged)
https://github.com/stephenh/async-local-storage-repro
https://github.com/puzpuzpuz/cls-rtracer (run tests with Node 16.2.0)
https://github.com/fastify/fastify-request-context/ (run npm run test:jest with Node 16.2.0)
envinfo
System:
OS: Windows 10 10.0.19041
CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
Binaries:
Node: 16.2.0 - C:\software\node\node.EXE
Yarn: 1.22.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 7.13.0 - C:\software\node\npm.CMD
npmPackages:
jest: ^26.6.3 => 26.6.3