hill
PPrisma
•Created by hill on 5/5/2024 in #help-and-questions
Prisma ORM with Cloudflare D1/Next-on-pages
Thanks Zilla, might try to mess around with it a bit tomorrow. The kicker is that with D1 on Pages, since it is a page function (possibly?) it doesnt use a url for the connection - I get why its needed for local development, but I've just adapted the existing code and tweaked it a bit: import { PrismaClient } from "@prisma/client";
import { PrismaD1 } from "@prisma/adapter-d1";
import { getRequestContext } from "@cloudflare/next-on-pages";
const adapter = new PrismaD1(getRequestContext().env.DB);
export const db = new PrismaClient({ adapter });
3 replies