Issue with Prisma Adapter in NextAuth.js
Unanswered
English Angora posted this in #help-forum
English AngoraOP
I am experiencing an issue with the Prisma adapter while following the official instructions provided at NextAuth Prisma Adapter Guide. Below are the details of my setup and the error I encountered.
Setup Details:
@auth/prisma-adapter: ^1.4.0
@next-auth/prisma-adapter: ^1.0.7
@prisma/client: ^5.9.1
next: ^14.2.3
next-auth: ^5.0.0-beta.18
Prisma Schema:
I have used the exact Prisma schema as specified in the guide without making any modifications.
Issue Encountered:
Upon attempting to sign in with GitHub, I immediately encounter the following error (screnshots)
I have ensured that my Prisma client is regenerated.
Could you please provide guidance on how to resolve this error? Any insights or suggestions would be greatly appreciated.
Thank you for your assistance.
Setup Details:
@auth/prisma-adapter: ^1.4.0
@next-auth/prisma-adapter: ^1.0.7
@prisma/client: ^5.9.1
next: ^14.2.3
next-auth: ^5.0.0-beta.18
Prisma Schema:
I have used the exact Prisma schema as specified in the guide without making any modifications.
Issue Encountered:
Upon attempting to sign in with GitHub, I immediately encounter the following error (screnshots)
I have ensured that my Prisma client is regenerated.
Could you please provide guidance on how to resolve this error? Any insights or suggestions would be greatly appreciated.
Thank you for your assistance.
4 Replies
Yellow-legged Gull
just from the info at hand i can say that you are passing an invalid query that doesn't fit your schema.
your query should probably look like this:
model Account {
id String @id @default(cuid())
userId String
providerType String
providerId String
providerAccountId String
refreshToken String?
accessToken String?
accessTokenExpires DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id])
@@unique([providerId, providerAccountId])
}your query should probably look like this:
{
where: {
providerAccountId: "username",
providerId: "github"
}
}if you have properly set up your IDE, typescript should've been screaming at you about the invalid field.
English AngoraOP
Thank you for your assistance.
I have further investigated the issue and found that others have encountered similar problems. Specifically, I came across a related discussion in this GitHub issue https://github.com/nextauthjs/next-auth/issues/11205. However, the proposed solution in that thread does not resolve the issue in my case.
To reiterate, I am not directly interacting with the Account model or modifying queries in my codebase. Everything is handled by the default NextAuth functions and the Prisma adapter setup.
Given this context, could there be a deeper issue with the Prisma adapter integration or NextAuth configuration that could be causing this problem? Any additional insights or suggestions for troubleshooting would be greatly appreciated.
Thank you for your continued support.
I have further investigated the issue and found that others have encountered similar problems. Specifically, I came across a related discussion in this GitHub issue https://github.com/nextauthjs/next-auth/issues/11205. However, the proposed solution in that thread does not resolve the issue in my case.
To reiterate, I am not directly interacting with the Account model or modifying queries in my codebase. Everything is handled by the default NextAuth functions and the Prisma adapter setup.
Given this context, could there be a deeper issue with the Prisma adapter integration or NextAuth configuration that could be causing this problem? Any additional insights or suggestions for troubleshooting would be greatly appreciated.
Thank you for your continued support.