Error: Invariant: headers() expects to have requestAsyncStorage, none available.

Created a fresh create-t3-turbo and added my .env variables but getting the following error.
- error Error: Invariant: headers() expects to have requestAsyncStorage, none available. at Layout (./src/app/layout.tsx:43:79) at stringify (<anonymous>)
2 Replies
Lukem121
Lukem121OP•15mo ago
I have check the issues on the repo and there are others facing the same issue but no fixes. Seems I have found a "fix" 🤔 In page.tsx change from "edge" to "nodejs" export const runtime = "nodejs"; From other posts online have found windows is the cause.
Fossil
Fossil•7mo ago
For me this happened when calling headers() as part of the context for createServerSideHelpers. It is actually covered here: "That also means that you don't have the request and response at hand like you usually do. Make sure you're instantiating the server-side helpers with a context without req & res" https://trpc.io/docs/client/nextjs/server-side-helpers#1-internal-router
Want results from more Discord servers?
Add your server