cir*_*nce 6 oauth oauth-2.0 google-oauth prisma next-auth
我在 Prisma Adapter 开启的情况下使用 Next Auth 时遇到错误我在create-t3-app。我成功在 Planetscale 数据库中添加了数据。
\n当我尝试使用 Next Auth Google Provider登录时出现此错误。还有Discord Provider,我可以登录并创建帐户以及链接到该帐户的用户。由于以下错误,我无法使用 Google 创建帐户。
\nprisma:query BEGIN\nprisma:query INSERT INTO `foo`.`Account` (`id`,`userId`,`type`,`provider`,`providerAccountId`,`access_token`,`expires_at`,`token_type`,`scope`,`id_token`) VALUES (?,?,?,?,?,?,?,?,?,?)\nprisma:query ROLLBACK\nprisma:error\nInvalid `p.account.create()` invocation in\n~/node_modules/@next-auth/prisma-adapter/dist/index.js:19:42\n\n 16 },\n 17 updateUser: ({ id, ...data }) => p.user.update({ where: { id }, data }),\n 18 deleteUser: (id) => p.user.delete({ where: { id } }),\n\xe2\x86\x92 19 linkAccount: (data) => p.account.create(\nThe provided value for the column is too long for the column\'s type. Column: for\n[next-auth][error][adapter_error_linkAccount]\nhttps://next-auth.js.org/errors#adapter_error_linkaccount\nInvalid `p.account.create()` invocation in\n~/node_modules/@next-auth/prisma-adapter/dist/index.js:19:42\n\n 16 },\n 17 updateUser: ({ id, ...data }) => p.user.update({ where: { id }, data }),\n 18 deleteUser: (id) => p.user.delete({ where: { id } }),\n\xe2\x86\x92 19 linkAccount: (data) => p.account.create(\nThe provided value for the column is too long for the column\'s type. Column: for {\n message: \'\\n\' +\n \'Invalid `p.account.create()` invocation in\\n\' +\n \'~/node_modules/@next-auth/prisma-adapter/dist/index.js:19:42\\n\' +\n \'\\n\' +\n \' 16 },\\n\' +\n \' 17 updateUser: ({ id, ...data }) => p.user.update({ where: { id }, data }),\\n\' +\n \' 18 deleteUser: (id) => p.user.delete({ where: { id } }),\\n\' +\n \'\xe2\x86\x92 19 linkAccount: (data) => p.account.create(\\n\' +\n "The provided value for the column is too long for the column\'s type. Column: for",\n stack: \'Error: \\n\' +\n \'Invalid `p.account.create()` invocation in\\n\' +\n \'~/node_modules/@next-auth/prisma-adapter/dist/index.js:19:42\\n\' +\n \'\\n\' +\n \' 16 },\\n\' +\n \' 17 updateUser: ({ id, ...data }) => p.user.update({ where: { id }, data }),\\n\' +\n \' 18 deleteUser: (id) => p.user.delete({ where: { id } }),\\n\' +\n \'\xe2\x86\x92 19 linkAccount: (data) => p.account.create(\\n\' +\n "The provided value for the column is too long for the column\'s type. Column: for\\n" +\n \' at fn.handleRequestError (~/node_modules/@prisma/client/runtime/library.js:174:6477)\\n\' +\n \' at fn.handleAndLogRequestError (~/node_modules/@prisma/client/runtime/library.js:174:5907)\\n\' +\n \' at fn.request (~/node_modules/@prisma/client/runtime/library.js:174:5786)\\n\' +\n \' at async t._request (~/node_modules/@prisma/client/runtime/library.js:177:10477)\',\n name: \'Error\'\n}\n[next-auth][error][OAUTH_CALLBACK_HANDLER_ERROR]\nhttps://next-auth.js.org/errors#oauth_callback_handler_error\nInvalid `p.account.create()` invocation in\n~/node_modules/@next-auth/prisma-adapter/dist/index.js:19:42\n\n 16 },\n 17 updateUser: ({ id, ...data }) => p.user.update({ where: { id }, data }),\n 18 deleteUser: (id) => p.user.delete({ where: { id } }),\n\xe2\x86\x92 19 linkAccount: (data) => p.account.create(\nThe provided value for the column is too long for the column\'s type. Column: for Error:\nInvalid `p.account.create()` invocation in\n~/node_modules/@next-auth/prisma-adapter/dist/index.js:19:42\n\n 16 },\n 17 updateUser: ({ id, ...data }) => p.user.update({ where: { id }, data }),\n 18 deleteUser: (id) => p.user.delete({ where: { id } }),\n\xe2\x86\x92 19 linkAccount: (data) => p.account.create(\nThe provided value for the column is too long for the column\'s type. Column: for\n at fn.handleRequestError (~/node_modules/@prisma/client/runtime/library.js:174:6477)\n at fn.handleAndLogRequestError (~/node_modules/@prisma/client/runtime/library.js:174:5907)\n at fn.request (~/node_modules/@prisma/client/runtime/library.js:174:5786)\n at async t._request (~/node_modules/@prisma/client/runtime/library.js:177:10477) {\n name: \'LinkAccountError\',\n code: \'P2000\'\n}\nRun Code Online (Sandbox Code Playgroud)\n
我所要做的就是在我的 schema.prisma 文件中添加本机数据库类型@db.Text。有人能解释一下为什么 Discord 不需要这个设置而 Google 需要吗?
model Account {
id String @id @default(cuid())
userId String
type String
provider String
providerAccountId String
refresh_token String? @db.Text
access_token String? @db.Text
expires_at Int?
token_type String?
scope String?
id_token String? @db.Text
session_state String?
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([provider, providerAccountId])
@@index([userId])
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2765 次 |
| 最近记录: |