Better Auth 1.2.9 + Prisma: P2000 error when login
Hi everyone,
I'm using Better Auth v1.2.9 with Prisma as the adapter, and I'm encountering a PrismaClientKnownRequestError (P2000) when trying to log in using the Discord provider.
Here's the relevant error log:
The provided value for the column is too long for the column's type. Column: value
at ri.handleRequestError (webpack-internal:///(rsc)/./generated/prisma/runtime/library.js:7193:19)
at ri.handleAndLogRequestError (webpack-internal:///(rsc)/./generated/prisma/runtime/library.js:7156:18)
at ri.request (webpack-internal:///(rsc)/./generated/prisma/runtime/library.js:7137:18)
at async l (webpack-internal:///(rsc)/./generated/prisma/runtime/library.js:7805:25)
at async Object.create (webpack-internal:///(rsc)/./node_modules/better-auth/dist/adapters/prisma-adapter/index.mjs:123:28)
at async Object.create (webpack-internal:///(rsc)/./node_modules/better-auth/dist/shared/better-auth.WByh1Fkk.mjs:372:29)
at async createWithHooks (webpack-internal:///(rsc)/./node_modules/better-auth/dist/shared/better-auth.gs0ZuLWb.mjs:77:75)
at async Object.createVerificationValue (webpack-internal:///(rsc)/./node_modules/better-auth/dist/shared/better-auth.gs0ZuLWb.mjs:730:34)
at async generateState (webpack-internal:///(rsc)/./node_modules/better-auth/dist/shared/better-auth.dn8_oqOu.mjs:48:26)
at async eval (webpack-internal:///(rsc)/./node_modules/better-auth/dist/shared/better-auth.oUCDPPbQ.mjs:1472:37)
at async internalHandler (webpack-internal:///(rsc)/./node_modules/better-call/dist/index.js:586:26)
at async api.<computed> (webpack-internal:///(rsc)/./node_modules/better-auth/dist/api/index.mjs:563:28)
at async processRequest (webpack-internal:///(rsc)/./node_modules/better-call/dist/index.js:5147:30)
at async handler (webpack-internal:///(rsc)/./node_modules/better-call/dist/index.js:5167:25)
at async C:\Users\PC\Downloads\communityads\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:1:66877 {
code: 'P2000',
clientVersion: '6.12.0',
meta: { modelName: 'Verification', column_name: 'value' }
}
From what I understand, Better Auth is trying to create a record in the Verification table, but the value being inserted into the value column is too long for the column's data type.
My Schema
model User {
id String @id
name String
email String
emailVerified Boolean
image String?
createdAt DateTime
updatedAt DateTime
sessions Session[]
accounts Account[]
@@unique([email])
@@map("user")
}
model Session {
id String @id
expiresAt DateTime
token String
createdAt DateTime
updatedAt DateTime
ipAddress String?
userAgent String?
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([token])
@@map("session")
}
model Account {
id String @id
accountId String
providerId String
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
accessToken String?
refreshToken String?
idToken String?
accessTokenExpiresAt DateTime?
refreshTokenExpiresAt DateTime?
scope String?
password String?
createdAt DateTime
updatedAt DateTime
@@map("account")
}
model Verification {
id String @id
identifier String
value String
expiresAt DateTime
createdAt DateTime?
updatedAt DateTime?
@@map("verification")
}
I use mysql with prisma
I'm using Better Auth v1.2.9 with Prisma as the adapter, and I'm encountering a PrismaClientKnownRequestError (P2000) when trying to log in using the Discord provider.
Here's the relevant error log:
SERVER_ERROR: PrismaClientKnownRequestError:
Invalidprisma.verification.create() invocation:The provided value for the column is too long for the column's type. Column: value
at ri.handleRequestError (webpack-internal:///(rsc)/./generated/prisma/runtime/library.js:7193:19)
at ri.handleAndLogRequestError (webpack-internal:///(rsc)/./generated/prisma/runtime/library.js:7156:18)
at ri.request (webpack-internal:///(rsc)/./generated/prisma/runtime/library.js:7137:18)
at async l (webpack-internal:///(rsc)/./generated/prisma/runtime/library.js:7805:25)
at async Object.create (webpack-internal:///(rsc)/./node_modules/better-auth/dist/adapters/prisma-adapter/index.mjs:123:28)
at async Object.create (webpack-internal:///(rsc)/./node_modules/better-auth/dist/shared/better-auth.WByh1Fkk.mjs:372:29)
at async createWithHooks (webpack-internal:///(rsc)/./node_modules/better-auth/dist/shared/better-auth.gs0ZuLWb.mjs:77:75)
at async Object.createVerificationValue (webpack-internal:///(rsc)/./node_modules/better-auth/dist/shared/better-auth.gs0ZuLWb.mjs:730:34)
at async generateState (webpack-internal:///(rsc)/./node_modules/better-auth/dist/shared/better-auth.dn8_oqOu.mjs:48:26)
at async eval (webpack-internal:///(rsc)/./node_modules/better-auth/dist/shared/better-auth.oUCDPPbQ.mjs:1472:37)
at async internalHandler (webpack-internal:///(rsc)/./node_modules/better-call/dist/index.js:586:26)
at async api.<computed> (webpack-internal:///(rsc)/./node_modules/better-auth/dist/api/index.mjs:563:28)
at async processRequest (webpack-internal:///(rsc)/./node_modules/better-call/dist/index.js:5147:30)
at async handler (webpack-internal:///(rsc)/./node_modules/better-call/dist/index.js:5167:25)
at async C:\Users\PC\Downloads\communityads\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:1:66877 {
code: 'P2000',
clientVersion: '6.12.0',
meta: { modelName: 'Verification', column_name: 'value' }
}
From what I understand, Better Auth is trying to create a record in the Verification table, but the value being inserted into the value column is too long for the column's data type.
My Schema
model User {
id String @id
name String
email String
emailVerified Boolean
image String?
createdAt DateTime
updatedAt DateTime
sessions Session[]
accounts Account[]
@@unique([email])
@@map("user")
}
model Session {
id String @id
expiresAt DateTime
token String
createdAt DateTime
updatedAt DateTime
ipAddress String?
userAgent String?
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([token])
@@map("session")
}
model Account {
id String @id
accountId String
providerId String
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
accessToken String?
refreshToken String?
idToken String?
accessTokenExpiresAt DateTime?
refreshTokenExpiresAt DateTime?
scope String?
password String?
createdAt DateTime
updatedAt DateTime
@@map("account")
}
model Verification {
id String @id
identifier String
value String
expiresAt DateTime
createdAt DateTime?
updatedAt DateTime?
@@map("verification")
}
I use mysql with prisma