You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the improvement or update you wish to see?
The old configuration file, contained in the API Route (pages/api/auth/[...nextauth].ts / app/api/auth/[...nextauth]/route.ts), now becomes much shorter. These exports are designed to be used in an App Router API Route, but the rest of your app can stay in the Pages Router if you are gradually migrating!
app/api/auth/[...nextauth]/route.ts
import { handlers } from "@/auth"
export const { GET, POST } = handlers
Is there any context that might help us understand?
the example above can't be applied to Pages Router which receives NextApiRequest which is basically IncomingMessage from http node module.
i've been trying to migrate from v4 to v5 in larger project still using pages router (migrated from nextjs v12 only recently) for two days by now, but it seems to be really hard (going error by error, searching issues and discussions here, googling around as well and using bits and pieces to make it work), although "we introduced as few breaking changes as possible." I might remove the quoted sentence from the documentation too as it's really misleading
Does the docs page already exist? Please link to it.
Unfortunately the new route handlers are designed around App router API routes. You can keep your existing project in the pages router and just add the necessary handlers under src/app/api/auth/[...nextauth]/route.ts.
Next.js can route to both App router and Pages router routes as long as they don't have the same path
What is the improvement or update you wish to see?
Is there any context that might help us understand?
the example above can't be applied to Pages Router which receives
NextApiRequest
which is basicallyIncomingMessage
fromhttp
node module.i've been trying to migrate from v4 to v5 in larger project still using pages router (migrated from nextjs v12 only recently) for two days by now, but it seems to be really hard (going error by error, searching issues and discussions here, googling around as well and using bits and pieces to make it work), although "we introduced as few breaking changes as possible." I might remove the quoted sentence from the documentation too as it's really misleading
Does the docs page already exist? Please link to it.
https://authjs.dev/getting-started/migrating-to-v5
The text was updated successfully, but these errors were encountered: