Closed rexwreyes closed 5 months ago
Hi @rexwreyes 👋 thanks for raising this issue. I have not been able to reproduce it on the latest version of aws-amplify
and @aws-amplify/adapter-nextjs
However, I did notice that you are calling Amplify.configure with ssr: true
in the same file you are generating the cookie based client. Are you configuring Amplify anywhere else in your app?
Amplify.configure should be called on the client side, the ssr: true
makes it so that credentials are stored in cookies rather than local storage and sent to the server on SSR page requests.
If moving Amplify.configure
to an entry point file such as layout.tsx
doesn't work, another thing I would try is setting the authMode
on the request.
(await cookieBasedClient.graphql({
query: projectsByUserIdAndCreatedAt,
variables: {
userId: userid,
filter: {
_deleted: {
ne: true,
},
},
},
authMode: "iam",
})) as {
data: {
projectsByUserIdAndCreatedAt: {
items: Project[];
};
};
};
If that still doesn't work, then I would ask if you can provide a small sample app (could be a public github repo) that reproduces the issue consistently .
Closing this issue as we have not heard back from you. If you are still experiencing this, please feel free to reply back and provide any information previously requested and we'd be happy to re-open the issue.
Thank you!
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
GraphQL API
Amplify Version
v6
Amplify Categories
auth, api
Backend
None
Environment information
Describe the bug
When trying to use IAM as the auth for AppSync calls i get an error. I am having the same issue described here : https://github.com/aws-amplify/amplify-js/issues/12931. t says that the issue was fixed with v6.0.17 but i tried v6.0.17 and v6.0.20 and still get the error. It all works if i just switch to apikey.
Expected behavior
To not get an error that tells me to "set the "authMode" in generateClient" even though I already did.
Reproduction steps
Code Snippet
Log output
aws-exports.js