Next-auth Receiving 404 after login attempt in Next-auth development env

282 Views Asked by At

Next-auth Receiving 404 after login attempt in Next-auth development env. i have next-13.4.9 and next-auth-4.22.1, i tried many ways but didnt helped. not sure whats the problem.

2

There are 2 best solutions below

0
DevQandA On

In my case the solution was placing the file [...nextauth].ts into the folder pages/api/auth. The folder pages should be at same level as the app folder. To make this change effective you should restart the server.

0
Tormod Flesjø On

If you're using a custom server like server.js in your root folder you might encounter unexpected behaviour since Vercel don't support it right now [Dec 2023].

If this is the case, you could try and deploy it elsewhere, like Netlify.