-
EnvironmentSystem: Reproduction URLDescribe the issueI upgraded and I followed https://next-auth.js.org/getting-started/upgrade-v4#database-migration but now I am getting the following when and the following when
I went back I made sure that the schema as per 2 guides I follow but no. Really confusing which adapter to choose and even what is the write schema. I had the same problem a while back and I made everything work and now after upgrading the app naturally everything stopped working. I have 2 simple questions: How to reproducehere is the final schema, but I tested all possible schema I found
Expected behaviorit should just work |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 17 replies
-
Did you found a solution? |
Beta Was this translation helpful? Give feedback.
-
Actually, almost every time I updated the library I have such issues, the fields change often and their names do not follow the naming convention for DB, another issue is the last version of |
Beta Was this translation helpful? Give feedback.
-
I have the same issue with @next-auth/prisma-adapter": "^1.0.7, "@prisma/client": "^4.15.0" and sqlite. Unknown arg |
Beta Was this translation helpful? Give feedback.
-
Changing the schema will still cause the problem. |
Beta Was this translation helpful? Give feedback.
-
This is my Prisma schema and i am still getting the Unknown argument
|
Beta Was this translation helpful? Give feedback.
-
No…hahaha
… 2023. 7. 24. 오후 6:12, Manish Bisht ***@***.***> 작성:
model Account {
id String @id <https://github.com/id> @default <https://github.com/default>(cuid())
userId String
providerType String
providerId String
role String
providerAccountId String
refreshToken String?
accessToken String?
accessTokenExpires DateTime?
createdAt DateTime @default <https://github.com/default>(now())
updatedAt DateTime @updatedAt
user User @relation <https://github.com/relation>(fields: [userId], references: [id])
@@unique([providerId, providerAccountId])
@@Index([userId])
}
model Session {
id String @id <https://github.com/id> @default <https://github.com/default>(cuid())
userId String
expires DateTime
sessionToken String @unique <https://github.com/unique>
accessToken String @unique <https://github.com/unique>
role String
createdAt DateTime @default <https://github.com/default>(now())
updatedAt DateTime @updatedAt
user User @relation <https://github.com/relation>(fields: [userId], references: [id])
@@Index([userId])
}
model User {
id String @id <https://github.com/id> @default <https://github.com/default>(cuid())
name String?
email String? @unique <https://github.com/unique>
emailVerified DateTime?
image String?
role String
createdAt DateTime @default <https://github.com/default>(now())
updatedAt DateTime @updatedAt
accounts Account[]
sessions Session[]
}
model VerificationRequest {
id String @id <https://github.com/id> @default <https://github.com/default>(cuid())
identifier String
token String @unique <https://github.com/unique>
expires DateTime
createdAt DateTime @default <https://github.com/default>(now())
updatedAt DateTime @updatedAt
@@unique([identifier, token])
}
This is my Prisma schema and i am still getting the
Unknown argument provider_providerAccountId. Did you mean providerId_providerAccountId? Available options are listed in green. PrismaClientValidationError:
Invalid prisma.account.findUnique() invocation:
{
where: {
provider_providerAccountId: {
~~~~~~~~~~~~~~~~~~~~~~~~~~
providerAccountId: "113802192673870361114",
provider: "google"
},
? id?: String,
—
Reply to this email directly, view it on GitHub <#4653 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/A3S5FEZTTX2NA57V7RSMAQDXRY36ZANCNFSM6AAAAAAQO27P6Y>.
You are receiving this because you commented.
|
Beta Was this translation helpful? Give feedback.
-
I just encountered this as I was using the template schema from the next-auth documentation with the new authjs/prisma-adapter. There are some slight changes in schema, and once I used the template from the new documentation, it all worked as expected. |
Beta Was this translation helpful? Give feedback.
-
God bless you!
пт, 8 сент. 2023 г. в 21:10, Nico ***@***.***>:
… I just encountered this as I was using the template schema from the
next-auth documentation with the new authjs/prisma-adapter. There are some
slight changes in schema, and once I used the template from the new
documentation, it all worked as expected.
New docs: https://authjs.dev/reference/adapter/prisma#prismaadapter
Old docs: https://next-auth.js.org/v3/adapters/prisma
—
Reply to this email directly, view it on GitHub
<#4653 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASHJOOQFOW3A357XCIAT5ETXZNNSZANCNFSM6AAAAAAQO27P6Y>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Despite exploring various solutions, the issue persists. For context, I'm working with the following versions in my project:
After encountering this challenge, I decided not to spend much time on it. Instead, I opted for a more flexible approach by implementing a Custom Adapter. This has given me full control over the authentication process. While this workaround suits my current needs, I'm still interested in any insights or solutions that might address the original issue with the prescribed setup. I appreciate any guidance or feedback from the community. |
Beta Was this translation helpful? Give feedback.
Actually, almost every time I updated the library I have such issues, the fields change often and their names do not follow the naming convention for DB, another issue is the last version of
prisma
,npx prisma db pull
cmd seems to override the@map
so I needed to update the DB to make everything worksHere is what works for me on
next-auth 4.15.0
prisma 4.5.0
@next-auth/prisma-adapter 1.0.5
change table name
accounts
toaccount
change table name
users
touser
change attribute on
provider_account_id
toproviderAccountId
change FK
user_id
touserId
(FK onaccount
table)change attribute
email_verified
toemailVerified
onuser
tableMake
provider
andproviderAccountId
uniqueOn Hasura if you…