turbo: [turbopack] Invariant: AsyncLocalStorage accessed in runtime where it is not available
What version of Turbopack are you using?
next 13.1.2
What package manager are you using / does the bug impact?
pnpm
What operating system are you using?
Mac
Describe the Bug
Turbopack throws the runtime error Invariant: AsyncLocalStorage accessed in runtime where it is not available when attempting to start up a Next.js project with appDir: true. Webpack works as expected.
Expected Behavior
Turbopack should works as what Webpack does.
To Reproduce
- Create a Next app with
appDirenabled:
$ pnpm create next-app@latest
../.pnpm-store/v3/tmp/dlx-90629 | +1 +
Packages are hard linked from the content-addressable store to the virtual store.
Content-addressable store is at: /Volumes/Dev/.pnpm-store/v3
Virtual store is at: ../.pnpm-store/v3/tmp/dlx-90629/node_modules/.pnpm
../.pnpm-store/v3/tmp/dlx-90629 | Progress: resolved 1, reused 0, downloaded 1, added 1, done
✔ What is your project named? … experiments
✔ Would you like to use TypeScript with this project? … No / [Yes]
✔ Would you like to use ESLint with this project? … No / [Yes]
✔ Would you like to use `src/` directory with this project? … No / [Yes]
✔ Would you like to use experimental `app/` directory with this project? … No / [Yes]
Creating a new Next.js app in /Volumes/Dev/Experiments/experiments.
Using pnpm.
Installing dependencies:
- react
- react-dom
- next
- @next/font
- typescript
- @types/react
- @types/node
- @types/react-dom
- eslint
- eslint-config-next
Packages: +267
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
Content-addressable store is at: /Volumes/Dev/.pnpm-store/v3
Virtual store is at: node_modules/.pnpm
dependencies:
+ @next/font 13.1.2
+ @types/node 18.11.18
+ @types/react 18.0.26
+ @types/react-dom 18.0.10
+ eslint 8.32.0
+ eslint-config-next 13.1.2
+ next 13.1.2
+ react 18.2.0
+ react-dom 18.2.0
+ typescript 4.9.4
Progress: resolved 279, reused 267, downloaded 0, added 267, done
Done in 15.2s
Initializing project with template: app
Initialized a git repository.
Success! Created experiments at /Volumes/Dev/Experiments/experiments
- Run
pnpm dev --turbo. It throws.
Turbopack
Webpack
Reproduction Repo
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 15
- Comments: 19 (2 by maintainers)
Commits related to this issue
- Install AsyncLocalStorage for appDir rendering (#3374) https://github.com/vercel/next.js/pull/44668 refactored Next's use of `AsyncLocalStorage`, and installs a "polyfill" of the API by patching the ... — committed to vercel/turbo by jridgewell a year ago
- Install AsyncLocalStorage for appDir rendering (vercel/turbo#3374) https://github.com/vercel/next.js/pull/44668 refactored Next's use of `AsyncLocalStorage`, and installs a "polyfill" of the API by p... — committed to vercel/next.js by jridgewell a year ago
- Install AsyncLocalStorage for appDir rendering (vercel/turbo#3374) https://github.com/vercel/next.js/pull/44668 refactored Next's use of `AsyncLocalStorage`, and installs a "polyfill" of the API by p... — committed to vercel/next.js by jridgewell a year ago
I have the same issue
Hi all, I’ll be addressing this today. It’s likely we’ll need a new Next.js canary release in order for this to take effect. In the meantime, you should be able to
npm install next@13.1.2-canary.2to temporarily undo the breaking PRI have the same issue, started facing it today so probably its a turbopack bug
change the ‘next’ to 13.1.0 in package.json and pnpm i