Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I had a problem with prisma schema and took 2 days to solve it. Basically i was not able to login with google auth. I get below error. I fix it via below issue on github and I just want to calobrate with solution.
nextauthjs/next-auth#3815
please do not forget to execute below code after you change your schema.prisma file
npx prisma db push
file should be like below:
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mongodb"
url = env("DATABASE_URL")
}
model User {
id String @id @default(uuid()) @Map("_id")
name String
email String @unique
emailVerified DateTime? @Map("email_verified")
image String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
accounts Account[]
sessions Session[]
Post Post[]
Comment Comment[]
@@Map("users")
}
model Account {
id String @id @default(cuid()) @Map("_id")
userId String @Map("user_id")
type String?
provider String
providerAccountId String @Map("provider_account_id")
token_type String?
refresh_token String?
access_token String?
expires_at Int?
scope String?
id_token String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([provider, providerAccountId])
@@Map("accounts")
}
model Session {
id String @id @default(cuid()) @Map("_id")
userId String? @Map("user_id")
sessionToken String @unique @Map("session_token")
accessToken String? @Map("access_token")
expires DateTime
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@Map("sessions")
}
model VerificationRequest {
id String @id @default(cuid()) @Map("_id")
identifier String
token String @unique
expires DateTime
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([identifier, token])
}
model Category {
id String @id @default(cuid()) @Map("_id")
slug String @unique
title String
img String?
Posts Post[]
}
model Post {
id String @id @default(cuid()) @Map("_id")
createdAt DateTime @default(now())
slug String @unique
title String
desc String
img String?
views Int @default(0)
catSlug String
cat Category @relation(fields: [catSlug], references: [slug])
userEmail String
user User @relation(fields: [userEmail], references: [email])
comments Comment[]
}
model Comment {
id String @id @default(cuid()) @Map("_id")
createdAt DateTime @default(now())
desc String
userEmail String
user User @relation(fields: [userEmail], references: [email])
postSlug String
post Post @relation(fields: [postSlug], references: [slug])
}
ERROR :
[next-auth][warn][NEXTAUTH_URL]
https://next-auth.js.org/warnings#nextauth_url
[next-auth][error][adapter_error_getUserByAccount]
https://next-auth.js.org/errors#adapter_error_getuserbyaccount
Invalid
prisma.account.findUnique()
invocation:{
where: {
provider_providerAccountId: {
~~~~~~~~~~~~~~~~~~~~~~~~~~
providerAccountId: "secret",
provider: "google"
},
? id?: String,
? providerId_providerAccountId?: AccountProviderIdProviderAccountIdCompoundUniqueInput,
? AND?: AccountWhereInput | AccountWhereInput[],
? OR?: AccountWhereInput[],
? NOT?: AccountWhereInput | AccountWhereInput[],
? userId?: StringFilter | String,
? providerType?: StringFilter | String,
? providerId?: StringFilter | String,
? providerAccountId?: StringFilter | String,
? refreshToken?: StringNullableFilter | String | Null,
? accessToken?: StringNullableFilter | String | Null,
? accessTokenExpires?: DateTimeNullableFilter | DateTime | Null,
? createdAt?: DateTimeFilter | DateTime,
? updatedAt?: DateTimeFilter | DateTime,
? user?: UserRelationFilter | UserWhereInput
},
select: {
user: true
}
}
Unknown argument
provider_providerAccountId
. Did you meanproviderId_providerAccountId
? Available options are listed in green. {message: '\n' +
'Invalid
prisma.account.findUnique()
invocation:\n' +'\n' +
'{\n' +
' where: {\n' +
' provider_providerAccountId: {\n' +
' ~~~~~~~~~~~~~~~~~~~~~~~~~~\n' +
' providerAccountId: "secret",\n' +
' provider: "google"\n' +
' },\n' +
'? id?: String,\n' +
'? providerId_providerAccountId?: AccountProviderIdProviderAccountIdCompoundUniqueInput,\n' +
'? AND?: AccountWhereInput | AccountWhereInput[],\n' +
'? OR?: AccountWhereInput[],\n' +
'? NOT?: AccountWhereInput | AccountWhereInput[],\n' +
'? userId?: StringFilter | String,\n' +
'? providerType?: StringFilter | String,\n' +
'? providerId?: StringFilter | String,\n' +
'? providerAccountId?: StringFilter | String,\n' +
'? refreshToken?: StringNullableFilter | String | Null,\n' +
'? accessToken?: StringNullableFilter | String | Null,\n' +
'? accessTokenExpires?: DateTimeNullableFilter | DateTime | Null,\n' +
'? createdAt?: DateTimeFilter | DateTime,\n' +
'? updatedAt?: DateTimeFilter | DateTime,\n' +
'? user?: UserRelationFilter | UserWhereInput\n' +
' },\n' +
' select: {\n' +
' user: true\n' +
' }\n' +
'}\n' +
'\n' +
'Unknown argument
provider_providerAccountId
. Did you meanproviderId_providerAccountId
? Available options are listed in green.',stack: 'PrismaClientValidationError: \n' +
'Invalid
prisma.account.findUnique()
invocation:\n' +'\n' +
'{\n' +
' where: {\n' +
' provider_providerAccountId: {\n' +
' ~~~~~~~~~~~~~~~~~~~~~~~~~~\n' +
' providerAccountId: "secret",\n' +
' provider: "google"\n' +
' },\n' +
'? id?: String,\n' +
'? providerId_providerAccountId?: AccountProviderIdProviderAccountIdCompoundUniqueInput,\n' +
'? AND?: AccountWhereInput | AccountWhereInput[],\n' +
'? OR?: AccountWhereInput[],\n' +
'? NOT?: AccountWhereInput | AccountWhereInput[],\n' +
'? userId?: StringFilter | String,\n' +
'? providerType?: StringFilter | String,\n' +
'? providerId?: StringFilter | String,\n' +
'? providerAccountId?: StringFilter | String,\n' +
'? refreshToken?: StringNullableFilter | String | Null,\n' +
'? accessToken?: StringNullableFilter | String | Null,\n' +
'? accessTokenExpires?: DateTimeNullableFilter | DateTime | Null,\n' +
'? createdAt?: DateTimeFilter | DateTime,\n' +
'? updatedAt?: DateTimeFilter | DateTime,\n' +
'? user?: UserRelationFilter | UserWhereInput\n' +
' },\n' +
' select: {\n' +
' user: true\n' +
' }\n' +
'}\n' +
'\n' +
'Unknown argument
provider_providerAccountId
. Did you meanproviderId_providerAccountId
? Available options are listed in green.\n' +' at yn (/Users/cansurer/Documents/dev-workspace/next-react-blog/node_modules/@prisma/client/runtime/library.js:116:5852)\n' +
' at wn.handleRequestError (/Users/cansurer/Documents/dev-workspace/next-react-blog/node_modules/@prisma/client/runtime/library.js:123:6429)\n' +
' at wn.handleAndLogRequestError (/Users/cansurer/Documents/dev-workspace/next-react-blog/node_modules/@prisma/client/runtime/library.js:123:6119)\n' +
' at wn.request (/Users/cansurer/Documents/dev-workspace/next-react-blog/node_modules/@prisma/client/runtime/library.js:123:5839)\n' +
' at async l (/Users/cansurer/Documents/dev-workspace/next-react-blog/node_modules/@prisma/client/runtime/library.js:128:9763)\n' +
' at async getUserByAccount (webpack-internal:///(rsc)/./node_modules/@auth/prisma-adapter/index.js:220:29)',
name: 'PrismaClientValidationError'
}
[next-auth][error][OAUTH_CALLBACK_HANDLER_ERROR]
https://next-auth.js.org/errors#oauth_callback_handler_error
Invalid
prisma.account.findUnique()
invocation:{
where: {
provider_providerAccountId: {
~~~~~~~~~~~~~~~~~~~~~~~~~~
providerAccountId: "101939472610204082780",
provider: "google"
},
? id?: String,
? providerId_providerAccountId?: AccountProviderIdProviderAccountIdCompoundUniqueInput,
? AND?: AccountWhereInput | AccountWhereInput[],
? OR?: AccountWhereInput[],
? NOT?: AccountWhereInput | AccountWhereInput[],
? userId?: StringFilter | String,
? providerType?: StringFilter | String,
? providerId?: StringFilter | String,
? providerAccountId?: StringFilter | String,
? refreshToken?: StringNullableFilter | String | Null,
? accessToken?: StringNullableFilter | String | Null,
? accessTokenExpires?: DateTimeNullableFilter | DateTime | Null,
? createdAt?: DateTimeFilter | DateTime,
? updatedAt?: DateTimeFilter | DateTime,
? user?: UserRelationFilter | UserWhereInput
},
select: {
user: true
}
}
Unknown argument
provider_providerAccountId
. Did you meanproviderId_providerAccountId
? Available options are listed in green. PrismaClientValidationError:Invalid
prisma.account.findUnique()
invocation:{
where: {
provider_providerAccountId: {
~~~~~~~~~~~~~~~~~~~~~~~~~~
providerAccountId: "secret",
provider: "google"
},
? id?: String,
? providerId_providerAccountId?: AccountProviderIdProviderAccountIdCompoundUniqueInput,
? AND?: AccountWhereInput | AccountWhereInput[],
? OR?: AccountWhereInput[],
? NOT?: AccountWhereInput | AccountWhereInput[],
? userId?: StringFilter | String,
? providerType?: StringFilter | String,
? providerId?: StringFilter | String,
? providerAccountId?: StringFilter | String,
? refreshToken?: StringNullableFilter | String | Null,
? accessToken?: StringNullableFilter | String | Null,
? accessTokenExpires?: DateTimeNullableFilter | DateTime | Null,
? createdAt?: DateTimeFilter | DateTime,
? updatedAt?: DateTimeFilter | DateTime,
? user?: UserRelationFilter | UserWhereInput
},
select: {
user: true
}
}
Unknown argument
provider_providerAccountId
. Did you meanproviderId_providerAccountId
? Available options are listed in green.at yn (/Users/cansurer/Documents/dev-workspace/next-react-blog/node_modules/@prisma/client/runtime/library.js:116:5852)
at wn.handleRequestError (/Users/cansurer/Documents/dev-workspace/next-react-blog/node_modules/@prisma/client/runtime/library.js:123:6429)
at wn.handleAndLogRequestError (/Users/cansurer/Documents/dev-workspace/next-react-blog/node_modules/@prisma/client/runtime/library.js:123:6119)
at wn.request (/Users/cansurer/Documents/dev-workspace/next-react-blog/node_modules/@prisma/client/runtime/library.js:123:5839)
at async l (/Users/cansurer/Documents/dev-workspace/next-react-blog/node_modules/@prisma/client/runtime/library.js:128:9763)
at async getUserByAccount (webpack-internal:///(rsc)/./node_modules/@auth/prisma-adapter/index.js:220:29) {
name: 'GetUserByAccountError',
code: undefined
}