-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Next.JS v15 and changes tocookies()
as well as other API's
#13924
Comments
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 Async Request API's that will potentially have breaking changes |
Is this going to be a fast update? Being that cookies relate to authenticated fetch requests this causes errors almost everywhere without the ability to ignore specific errors its pretty annoying in dev. Also Next 15 stable was released... this week. |
Hi all, we've started testing the code changes with Next.js v15. Thanks for your patience. |
Thanks for your hard work on this, I know there are many other things going on, so much appreciated. |
Hi all, the Next.js 15 support is now testable with the tag release npm install aws-amplify@next-15 @aws-amplify/adapter-nextjs@next-15 We will continue testing with Next.js 15 to ensure it's stable before the formal release. Please let us know if you encounter any issue while testing, much appreciated! |
I can see the error is no longer getting thrown, so that's great However (and my apologies if this is a separate issue) within the operation when I attempt to
Even though Once the app initializes on the client, amplify correctly detects the user, so my issue is isolated to the server only. Any ideas on what I might've missed / could do to debug? |
Hi @austinjlaverty thanks for following up. For |
Someone else has since opened a ticket for the same thing with next 14, so whatever I've run into probably isn't related to the original async cookies issue. Will continue the conversation there |
Thanks you, maintainers, for publishing the v15-compatible NPM cacary release. |
cookies()
should be awaited before using its value with NextJS 15cookies()
as well as other API's
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
// Put your code below this line.
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
The text was updated successfully, but these errors were encountered: