Skip to content

Instantly share code, notes, and snippets.

@adithep
adithep / prisma.ts
Created September 3, 2024 06:27 — forked from kincaidoneil/prisma.ts
Connect to Supabase with Prisma on the Edge (e.g. Vercel Edge functions). Test locally by running the Supabase connection pooler
import { neonConfig, Pool } from '@neondatabase/serverless'
import { PrismaNeon } from '@prisma/adapter-neon'
import { PrismaClient } from '@prisma/client'
import { WebSocket } from 'ws'
// Example Supabase pooled connection string (must use Supavisor)
const connectionString =
'postgres://[username].[id]:[password]@aws-0-us-east-1.pooler.supabase.com:5432/[db]'
const url = new URL(connectionString)