Closed f00d4tehg0dz closed 1 year ago
I fixed this problem by copy/paste the [...nextauth].ts from (https://github.com/nextauthjs/next-auth-example/tree/main/pages/api/auth)
Then in the // pages/api/post/index.ts. Add: import { getServerSession } from "next-auth"; import { authOptions } from "../auth/[...nextauth]"
Remove: import { getSession } from 'next-auth/react';
change: const session = await getSession({ req }); to: const session = await getServerSession(req, res, authOptions);
Hope this helps!
const session = await getServerSession(req, res, authOptions);
This was key for me getting things moving again; Thanks!
After upgrading the final branch to Next.js 13 and Next Auth 4.22.x you are no longer able to make an authenticated post. Sign-in authentication works as expected, however.
Error
[next-auth][error][CLIENT_FETCH_ERROR]
Invalid prisma.post.create() invocation: