next-auth: TypeError: prisma[Account].findOne is not a function

Describe the bug On next-auth 3.1.0. Error is thrown on trying to login with OAuth provider (GitHub). This only started happening after I updated prisma to 2.15.0.

Steps to reproduce

  1. Update prisma to 2.15.0 and try to log in.
[next-auth][error][get_user_by_provider_account_id_error] TypeError: prisma[Account].findOne is not a function
    at D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\adapters\prisma\index.js:148:36
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\adapters\prisma\index.js:16:103)
    at _next (D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\adapters\prisma\index.js:18:194)
    at D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\adapters\prisma\index.js:18:364
    at new Promise (<anonymous>)
    at D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\adapters\prisma\index.js:18:97
    at _getUserByProviderAccountId (D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\adapters\prisma\index.js:159:44)
    at getUserByProviderAccountId (D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\adapters\prisma\index.js:140:44)
    at D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\server\routes\callback.js:83:55
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\server\routes\callback.js:26:103)
    at _next (D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\server\routes\callback.js:28:194)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
https://next-auth.js.org/errors#get_user_by_provider_account_id_error
[next-auth][error][oauth_callback_handler_error] Error: GET_USER_BY_PROVIDER_ACCOUNT_ID_ERROR
    at D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\adapters\prisma\index.js:156:35
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\adapters\prisma\index.js:16:103)
    at _next (D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\adapters\prisma\index.js:18:194)
    at D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\adapters\prisma\index.js:18:364
    at new Promise (<anonymous>)
    at D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\adapters\prisma\index.js:18:97
    at _getUserByProviderAccountId (D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\adapters\prisma\index.js:159:44)
    at getUserByProviderAccountId (D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\adapters\prisma\index.js:140:44)
    at D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\server\routes\callback.js:83:55
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\server\routes\callback.js:26:103)
    at _next (D:\projects\2020-2021uam\se\lets-watch-it-together\node_modules\next-auth\dist\server\routes\callback.js:28:194)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
https://next-auth.js.org/errors#oauth_callback_handler_error

Related to https://github.com/nextauthjs/next-auth/issues/1099 I think the fix there is to use canary (branch?) Whatever the fix is, it’s not in stable so I will include this issue, since someone else probably will if I don’t 😄

I did install npm i next-auth@canary, which allowed me to travel in time to the future once the issue is fixed and get 3.2.0, and I confirm the issue is fixed there. It’s still in stable though. Cherry-pick into stable maybe pls?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 17 (10 by maintainers)

Most upvoted comments

We plan to get canary into stable in the nearest future. Until then, please just use canary. 🙂

nextauthjs/next-auth has been migrated to a monorepository. The adapters code can now be found there under packages/adapter-*. Thanks for your interest in the project!