Closed Aldo-Garza closed 2 months ago
Hi @Aldo-Garza 👋 thanks for raising this issue and providing reproduction steps!
I will attempt to reproduce the behavior and update this issue accordingly for the team to take action
Hi all, this cookie mutation is an expected behavior given current implementation of the credentials fetching logic. We will look into this.
To add to what @HuiSF said, this appears to be expected behavior. However, we'll mark this as a feature request at this point to explore other/better options for how we're handling the Identity Id every time the credentials are refreshed.
Hi @Aldo-Garza we've released a change to remove this redundant Set-Cookie
header, you can gain the fix by installing aws-amplify@6.6.3
and @aws-amplify/adapter-nextjs@1.2.20
.
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
GraphQL API, DataStore
Amplify Version
v6
Amplify Categories
storage
Backend
Amplify Gen 2 (Preview)
Environment information
Describe the bug
In nextjs, if a server action is called, and such server action fetches any data from a model like for example the following:
It causes a mutation on the cookies (it deletes a cookie), such cookie looks like:
This causes unexpected behaviours in nextjs, since the cookie is beign mutated it ends up causing a refresh of the server component
Expected behavior
It should not mutate the cookies. I fixed it by patching the delete method of cookies()
Reproduction steps
1- Create a server component which reads some data for display 2- Inside the server component add a button which calls a server action, such server action must use the cookies client for calling list() on a model for example 3- When calling the server action it will cause the cookies to be mutated which will make the server component to re-render (refresh) even though nothing was changed.
Code 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