在我的Next.js
应用程序中,我使用next-auth
进行身份验证,使用@next-auth/prisma-adapter
和MySQL作为数据库提供程序。当我尝试使用OAuth登录时,我得到以下错误:
https://next-auth.js.org/errors#adapter_error_getuserbyaccount
Invalid `p.account.findUnique()` invocation in
/Users/vignesh/projects/bmi-api/node_modules/@next-auth/prisma-adapter/dist/index.js:211:45
208 getUserByEmail: (email) => p.user.findUnique({ where: { email } }),
209 async getUserByAccount(provider_providerAccountId) {
210 var _a;
→ 211 const account = await p.account.findUnique(
The column `(not available)` does not exist in the current database. {
message: '\n' +
'Invalid `p.account.findUnique()` invocation in\n' +
'/Users/vignesh/projects/bmi-api/node_modules/@next-auth/prisma-adapter/dist/index.js:211:45\n' +
'\n' +
' 208 getUserByEmail: (email) => p.user.findUnique({ where: { email } }),\n' +
' 209 async getUserByAccount(provider_providerAccountId) {\n' +
' 210 var _a;\n' +
'→ 211 const account = await p.account.findUnique(\n' +
'The column `(not available)` does not exist in the current database.',
stack: 'Error: \n' +
'Invalid `p.account.findUnique()` invocation in\n' +
'/Users/vignesh/projects/bmi-api/node_modules/@next-auth/prisma-adapter/dist/index.js:211:45\n' +
'\n' +
' 208 getUserByEmail: (email) => p.user.findUnique({ where: { email } }),\n' +
' 209 async getUserByAccount(provider_providerAccountId) {\n' +
' 210 var _a;\n' +
'→ 211 const account = await p.account.findUnique(\n' +
'The column `(not available)` does not exist in the current database.\n' +
' at Zr.handleRequestError (/Users/vignesh/projects/bmi-api/node_modules/@prisma/client/runtime/library.js:171:6414)\n' +
' at Zr.handleAndLogRequestError (/Users/vignesh/projects/bmi-api/node_modules/@prisma/client/runtime/library.js:171:5948)\n' +
' at Zr.request (/Users/vignesh/projects/bmi-api/node_modules/@prisma/client/runtime/library.js:171:5786)\n' +
' at async t._request (/Users/vignesh/projects/bmi-api/node_modules/@prisma/client/runtime/library.js:174:10455)\n' +
' at async getUserByAccount (/Users/vignesh/projects/bmi-api/node_modules/@next-auth/prisma-adapter/dist/index.js:211:29)',
name: 'Error'
}
[next-auth][error][OAUTH_CALLBACK_HANDLER_ERROR]
https://next-auth.js.org/errors#oauth_callback_handler_error
Invalid `p.account.findUnique()` invocation in
/Users/vignesh/projects/bmi-api/node_modules/@next-auth/prisma-adapter/dist/index.js:211:45
208 getUserByEmail: (email) => p.user.findUnique({ where: { email } }),
209 async getUserByAccount(provider_providerAccountId) {
210 var _a;
→ 211 const account = await p.account.findUnique(
The column `(not available)` does not exist in the current database. Error:
Invalid `p.account.findUnique()` invocation in
/Users/vignesh/projects/bmi-api/node_modules/@next-auth/prisma-adapter/dist/index.js:211:45
208 getUserByEmail: (email) => p.user.findUnique({ where: { email } }),
209 async getUserByAccount(provider_providerAccountId) {
210 var _a;
→ 211 const account = await p.account.findUnique(
The column `(not available)` does not exist in the current database.
at Zr.handleRequestError (/Users/vignesh/projects/bmi-api/node_modules/@prisma/client/runtime/library.js:171:6414)
at Zr.handleAndLogRequestError (/Users/vignesh/projects/bmi-api/node_modules/@prisma/client/runtime/library.js:171:5948)
at Zr.request (/Users/vignesh/projects/bmi-api/node_modules/@prisma/client/runtime/library.js:171:5786)
at async t._request (/Users/vignesh/projects/bmi-api/node_modules/@prisma/client/runtime/library.js:174:10455)
at async getUserByAccount (/Users/vignesh/projects/bmi-api/node_modules/@next-auth/prisma-adapter/dist/index.js:211:29) {
name: 'GetUserByAccountError',
code: 'P2022'
}
依赖关系
{
"dependencies":{
"next": "13.4.4",
"next-auth": "^4.22.1",
"prisma": "4.11.0",
"@next-auth/prisma-adapter": "^1.0.7",
}
1条答案
按热度按时间ymdaylpp1#
我已经安装了我下面提到的软件包的旧版本。
1.我更新了
next-auth
、prisma
和@prisma/client
到它们的最新版本。1.已确保
prisma
和@prisma/client
的版本相同。1.做了
yarn prisma db push
和yarn prisma generate
。一切都在这之后开始顺利进行。