Open mattiaz9 opened 4 days ago
Hello, @mattiaz9 and thanks for opening this issue.
Currently, our NextJS adapter isn't supporting the breaking change that NextJS v15 introduces for the updates to the cookies()
function now being a Promise. As such, we're going to review how we can support the interface changes on the Amplify side to better support NextJS v15.
Async Request API's that will potentially have breaking changes
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
Authentication
Amplify Version
v6
Amplify Categories
auth
Backend
None
Environment information
Describe the bug
In the latest nextjs canary, cookies and headers are async, so they must be awaited.
This is the error it shows in console:
In route /dashboard a cookie property was accessed directly with
cookies().get('CognitoIdentityServiceProvider.xxxxxxxxxxxxxxxxxxxxx.LastAuthUser').
cookies()should be awaited before using its value. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis
code:
Expected behavior
Cookies should be awaited and no error should be shown in console.
Reproduction steps
getCurrentUser
inside a react server componentCode Snippet
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response