Can't pass PrismaLibSQL client-adapter to PrismaClient

I am using the T3-stack with Prisma. I just installed the required libraries for Turso. But when I try to setup the adapter into the PrismaClient. I receive a type error on the adapter passed to the client. Its like the PrismaClient class doesn't expect a value of adapter, no?

import { PrismaClient } from "@prisma/client";
import { createClient } from "@libsql/client";
import { PrismaLibSQL } from "@prisma/adapter-libsql";

import { env } from "~/env.mjs";

const globalForPrisma = globalThis as unknown as {
  prisma: PrismaClient | undefined;
};

const libSQL = createClient({
  url: `${process.env.TURSO_DATABASE_URL}`,
  authToken: `${process.env.TURSO_AUTH_TOKEN}`
});

const adapter = new PrismaLibSQL(libSQL);

export const db =
  globalForPrisma.prisma ??
  new PrismaClient({
    adapter // Type 'PrismaLibSQL' is not assignable to type 'never'.,
    log:
      env.NODE_ENV === "development" ? ["query", "error", "warn"] : ["error"],
  });

if (env.NODE_ENV !== "production") globalForPrisma.prisma = db;
Was this page helpful?