Migrating from nextauth/auth.js to better-auth
I'm currently in the process of migrating from auth.js to better-auth and have been following the guide here: https://www.better-auth.com/docs/guides/next-auth-migration-guide
I've been able to map or create the new columns per the guide (within schema.prisma), but now when I try to log in with Google I get the following error:
From my testing, this seems to be because of
@@id([providerId, accountId])
the error goes away when I replace this with a new id field/column in schema.prisma
, but this would be a risky migration to run on a production database (it would break all existing references to the Account
table). Are there any other solutions? Has anyone successfully migrated a production app from next-auth to better-auth?Migrating from NextAuth.js to Better Auth | Better Auth
A step-by-step guide to transitioning from NextAuth.js to Better Auth.
1 Reply
they are pretty much the same as far as I know. Also if you are migrating, why not first implement this on dev environment and if it's a success, deploy to prod?
Also can I please see your updated prisma.schema?