Replies: 5 comments 28 replies
-
That's a standard Next.js feature, it not special to next-auth https://nextjs.org/docs/api-routes/dynamic-api-routes#catch-all-api-routes the problem might be in your setup, although it's hard to tell without any reproduction. |
Beta Was this translation helpful? Give feedback.
-
seems that my concerns will turn up true - next auth actually treats some of these api routes as pages and AWS Amplify simply treats them as api routes and nothing else.. so I guess this won't work, I think I will have to use passport for that purpose |
Beta Was this translation helpful? Give feedback.
-
Hey everyone, I am having issues while deploying a next.js app using Next-auth in amplify, it seems the sign-in function is not working well using credentials provider. Is this related? |
Beta Was this translation helpful? Give feedback.
-
I've gotten NextAuth to work on Amplify before. I would recommend first testing your app on a hosted platform, such as Vercel. Since Vercel makes NextJS, it is super easy to deploy your app to their platform for testing. If it works there, redeploy to AWS. Be sure to set up your environment variables properly. You may also need to add an amplify.yml file to your project so Amplify passes your env variables into the application
|
Beta Was this translation helpful? Give feedback.
-
In my case, running the app in AWS Amplify, any of the methods to set environments on the build step worked without setting |
Beta Was this translation helpful? Give feedback.
-
Question 💬
After following the AWS Amplify Next.js tutorial AWS Amplify Next.js I was able to successfully deploy an app. So then I decided to add Prisma and NextAuth to handle the authentication, I added Google as my OAuth provider. It works perfectly in development, I've tested it out.
However, when I pushed my code and it got redeployed to AWS I started getting this error
So I am now wondering if there is a workaround for that.. In the AWS Amplify Next.js tutorial, at the bottom, they say the following:
Amplify now supports API routes in Next.js apps. Any file inside the folder pages/api is mapped to /api/* and treated as an API endpoint instead of a page. You can use these APIs to interface with any backend service to fetch data.
which makes me think that the issue comes from the fact that the NextAuth api handler's signature looks like this
[...nextauth].ts
Has anyone tried this combination, I think if it works it would be the best setup I've been able to find around. Really hoping that there is a workaround tbh.
Regards!
How to reproduce ☕️
that's it, you get the aforementioned error
Contributing 🙌🏽
Yes, I am willing to help answer this question in a PR
Beta Was this translation helpful? Give feedback.
All reactions