-
Notifications
You must be signed in to change notification settings - Fork 30.6k
Closed
Labels
bugIssue was opened via the bug report template.Issue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.
Description
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: Ubuntu 20.04.0 LTS Fri Feb 24 2023 12:23:18 GMT+0200 (Eastern European Standard Time)
Binaries:
Node: 16.14.2
npm: 7.17.0
Yarn: 1.22.19
pnpm: 7.13.6
Relevant packages:
next: 13.2.1
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true)
Link to the code that reproduces this issue
To Reproduce
Try to import cookies from next/headers
Try to access a dynamic page, eg /test/p
Describe the Bug
Error: Invariant: Method expects to have requestAsyncStorage, none available
This happens if I do an import of cookies
import { cookies } from 'next/headers';
const DynamicPage = async () => {
const nextCookies = cookies();
console.log(nextCookies.get('random'));
const data = await loadRandomData();
return <div>{data.title}</div>;
};
Expected Behavior
I can access the cookies object on a dynamic page
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugIssue was opened via the bug report template.Issue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.
