Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest breaks AsyncLocalStorage when running Node 16.2.0 #11435

Closed
kibertoad opened this issue May 22, 2021 · 3 comments
Closed

Jest breaks AsyncLocalStorage when running Node 16.2.0 #11435

kibertoad opened this issue May 22, 2021 · 3 comments

Comments

@kibertoad
Copy link

kibertoad commented May 22, 2021

馃悰 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:

  1. access AsyncLocalStorage.getStore
  2. await a promise
  3. 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
@blimmer
Copy link
Contributor

blimmer commented Jun 2, 2021

It looks like a fix should land in Node 16.3.0.

@kibertoad
Copy link
Author

Confirmed to have been fixed in 16.3.0

@github-actions
Copy link

github-actions bot commented Jul 5, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants