New Prisma generate and init

i receved an error when npx @better-auth/cli generate with a new version of Prisma.
No description
8 Replies
KiNFiSH
KiNFiSH7d ago
Please use your generated client on the auth config for initializing the adapters db If you do have a custom one Don't use @prisma/client Just use your generated client path And import Prisma client from there
RiLeX98
RiLeX98OP7d ago
import { PrismaClient } from "@prisma/client"; const globalForPrisma = global as unknown as { prisma: PrismaClient }; export const prisma = globalForPrisma.prisma || new PrismaClient(); if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma; this is my /lib/prisma.ts import { betterAuth } from "better-auth"; import { prismaAdapter } from "better-auth/adapters/prisma"; import { prisma } from "@/lib/prisma"; export const auth = betterAuth({ database: prismaAdapter(prisma, { provider: "postgresql", }), emailAndPassword: { enabled: true, }, }); and this is my auth.ts
KiNFiSH
KiNFiSH7d ago
Show me your schema.prisma ?
RiLeX98
RiLeX98OP7d ago
generator client { provider = "prisma-client-js" output = "../app/generated/prisma" } datasource db { provider = "postgresql" url = env("DATABASE_URL") } model User { id Int @id @default(autoincrement()) email String @unique name String? }
KiNFiSH
KiNFiSH7d ago
So use the output path which is your new client for auth config Instead of using Prisma client the default one
RiLeX98
RiLeX98OP7d ago
how?
KiNFiSH
KiNFiSH7d ago
like import the Prisma client not from @prisma/client .but from generated/prisma On your auth config
RiLeX98
RiLeX98OP7d ago
thanks bro. i solved it.

Did you find this page helpful?