Ano*_*use 11 next.js prisma next-auth
我将 next-auth 与自定义提供程序和 Prisma 适配器一起使用,我只想存储值:id、名称、国家/地区、头像和性别。但是,我收到此错误:
\n[next-auth][error][adapter_error_createUser] \nhttps://next-auth.js.org/errors#adapter_error_createuser\nInvalid `p.user.create()` invocation in\n.\\node_modules\\@next-auth\\prisma-adapter\\dist\\index.js:6:38\n\n 3 exports.PrismaAdapter = void 0;\n 4 function PrismaAdapter(p) {\n 5 return {\n\xe2\x86\x92 6 createUser: (data) => p.user.create({\n data: {\n name: [redacted],\n wcaId: [redacted],\n country: [redacted],\n avatar: [redacted],\n gender: [redacted],\n email: undefined,\n emailVerified: null\n ~~~~~~~~~~~~~\n }\n })\n\nUnknown arg `emailVerified` in data.emailVerified for type UserCreateInput. Available args:\n...\nRun Code Online (Sandbox Code Playgroud)\n我的自定义提供程序中的配置文件对象如下所示:
\nprofile(profile) {\n return {\n id: profile.me.id,\n name: profile.me.name,\n country: profile.me.country_iso2,\n avatar: profile.me.avatar.url,\n gender: profile.me.gender,\n };\n },\nRun Code Online (Sandbox Code Playgroud)\n我的 Prisma 模式中的所有内容都遵循https://next-auth.js.org/adapters/prisma#setup中的示例,但用户模型除外,如下所示:
\nmodel User {\n id String @id @default(cuid())\n name String\n country String @db.Char(2)\n avatar String\n gender String @db.Char(1)\n accounts Account[]\n sessions Session[]\n // Temporary workaround:\n email String? @unique\n emailVerified DateTime? @map("email_verified")\n}\nRun Code Online (Sandbox Code Playgroud)\n在错误中,适配器似乎已将 email 和 emailVerified 添加到数据对象中,因此我使用的临时解决方法是将 email 和 emailVerified 列添加到我的 Prisma 模型中,如上所示。但是,这并不理想,我想知道如何从数据库中删除这些不必要的列,因为它们的值始终未定义且为空。
\n| 归档时间: |
|
| 查看次数: |
1705 次 |
| 最近记录: |