Next.js Discord

Discord Forum

[SOLVED]Next-Auth: adapter_error_getuserbyaccount

Unanswered
Japanese common catfish posted this in #help-forum
Open in Discord
Japanese common catfishOP
I'm implementing next-auth in this fullstack application, and the authentication itself works fine, but when I try to create the authenticated user in the database, using an adapter, I'm facing these errors:
[next-auth][error][adapter_error_getUserByAccount] 
https://next-auth.js.org/errors#adapter_error_getuserbyaccount No Account found {
  message: 'No Account found',
  stack: 'NotFoundError: No Account found\n' +
    '    at /home/md/www/rocketseat/ignite/react/bookwise/node_modules/@prisma/client/runtime/library.js:112:610\n' +
    '    at async /home/md/www/rocketseat/ignite/react/bookwise/node_modules/@prisma/client/runtime/library.js:112:550\n' +
    '    at async getUserByAccount (webpack-internal:///(sc_server)/./src/lib/auth/prisma-adapter.ts:57:30)',
  name: 'NotFoundError'
}
[next-auth][error][OAUTH_CALLBACK_HANDLER_ERROR] 
https://next-auth.js.org/errors#oauth_callback_handler_error No Account found NotFoundError: No Account found
    at /home/md/www/rocketseat/ignite/react/bookwise/node_modules/@prisma/client/runtime/library.js:112:610
    at async /home/md/www/rocketseat/ignite/react/bookwise/node_modules/@prisma/client/runtime/library.js:112:550
    at async getUserByAccount (webpack-internal:///(sc_server)/./src/lib/auth/prisma-adapter.ts:57:30) {
  name: 'GetUserByAccountError',
  code: 'P2025'
}


I already tried changing my prisma schema, but these errors persisted...

Here's the link for the repo:
https://github.com/marcusdavanco/bookwise

Any help would be extremely appreciated.

1 Reply

Japanese common catfishOP
I was able to solve it!
In the end, I was using a custom adapter without purpose, I installed the latest version of the PrismaAdapter, and the problem was solved.
It's not perfect as It required me to create another column in the User model to handle the emailVerified property received during authentication or the creation would fail.

As this is for a study project, I'll leave it that way for now...
Thanks anyway!