1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-20 21:01:18 -04:00

revert @neondatabase/serverless

This commit is contained in:
2024-01-08 10:52:29 -05:00
parent 4b70a7b30d
commit 0844b70f78
3 changed files with 12 additions and 10 deletions

View File

@@ -5,14 +5,16 @@ import ws from "ws";
// https://www.prisma.io/blog/serverless-database-drivers-KML1ehXORxZV#use-neon-with-neondatabaseserverless
neonConfig.webSocketConstructor = ws;
const connectionString = `${process.env.DATABASE_URL}`;
// creating PrismaClient here prevents next.js from starting too many concurrent prisma instances and exhausting the
// number of connection pools available (especially when hot reloading from `next dev`).
// https://www.prisma.io/docs/guides/other/troubleshooting-orm/help-articles/nextjs-prisma-client-dev-practices
const prismaClientSingleton = () => {
const pool = new Pool({ connectionString });
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
ssl: true,
});
const adapter = new PrismaNeon(pool);
return new PrismaClient({ adapter });
};