Closed kennykingdev closed 1 year ago
Technically you should not be using v4 yet: https://github.com/nextauthjs/next-auth/blob/1e6daa8304aa98858f8e27eef092fbeb2f34f436/packages/adapter-prisma/package.json#L40
Happy to add support though, so is this just a TS issue? :thinking:
Yes.
It looks like this issue did not receive any activity for 60 days. It will be closed in 7 days if no further activity occurs. If you think your issue is still relevant, commenting will keep it open. Thanks!
Temporary work around until supported:
import { PrismaClient } from "@prisma/client";
export const authOptions: NextAuthOptions = {
adapter: PrismaAdapter(prisma as unknown as PrismaClient),
...
}
If necessary could replace PrismaClient
with a type extracted from your extended client, as described in this article.
It looks like this issue did not receive any activity for 60 days. It will be closed in 7 days if no further activity occurs. If you think your issue is still relevant, commenting will keep it open. Thanks!
To keep things tidy, we are closing this issue for now. If you think your issue is still relevant, leave a comment and we might reopen it. Thanks!
Any update on this?
This is still an issue I think in the latest version of the adapter
still facing an error using prisma.$extends. can you help why this is happen? @balazsorban44 , thank you.
here is my code:
all of this working fine, if i'm not using prisma extension.
Fixed by https://github.com/nextauthjs/next-auth/pull/9798 it seems, for others who arrive here
Question 💬
When using the new prisma client extensions that they introduced in 4.7.0, the type of the prisma client changes with whatever extensions you apply.
If you try to pass your extended prisma client into PrismaAdapter, TS complains about the types not matching what it expects.
For now I have both a standard prisma client and an extended client. I pass the standard client into PrismaAdapter and use the extended client where needed in callbacks and events.
I would prefer that PrismaAdapter accept an extended client so that I don't have import and use both clients in [...nextAuth].ts
How to reproduce ☕️
Contributing 🙌🏽
Yes, I am willing to help answer this question in a PR