Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Adapter type
@next-auth/prisma-adapter
Environment
System:
OS: Windows 10 10.0.19044
CPU: (6) x64 AMD Ryzen 5 3500X 6-Core Processor
Memory: 9.08 GB / 15.94 GB
Binaries:
Node: 16.15.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.11.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.1266.0), Chromium (104.0.1293.63)
Internet Explorer: 11.0.19041.1566
I use OperaGX LVL 4 (core: 89.0.4447.64)
npmPackages:
next: 12.1.0 => 12.1.0
next-auth: ^4.10.3 => 4.10.3
react: 17.0.2 => 17.0.2
@next-auth/prisma-adapter: ^1.0.4 => 1.0.4
Reproduction URL
https://github.com/Ginn0ji/test
Describe the issue
Prisma client is crashing with this error: "GetUserByAccountError", when I try signing in using the prisma adapter to push the account, session and user data to my database
How to reproduce
Install: npm install next-auth @prisma/client @next-auth/prisma-adapter and
npm install prisma --save-dev
Create your pages/api/auth/[...nextauth].js file with any provider you want and a prisma adapter like so:
Initialize prisma and configure your env file to connect your database
Copy the prisma schema from NextAuth docs and set the correct datasource provider (I'm using sqlite in this example, but I know that postgresql requires a shadowUrl and Planetscale racial integrity, you can easily google that):
After that make a simple ui like a Sign In button and don't forget to import the signIn function from "next-auth":
Not sure if I forgot something, I hope not.
Expected behavior
Instead of getting this error, it should've signed me in and then push the account, session and user data to my database.
Beta Was this translation helpful? Give feedback.
All reactions