NeonN
Neon2y ago
5 replies
urgent-maroon

Should PrismaNeon adapter use pooler URL?

Following the example code here:
import { Pool, neonConfig } from '@neondatabase/serverless'
import { PrismaNeon } from '@prisma/adapter-neon'
import { PrismaClient } from '@prisma/client'
import dotenv from 'dotenv'
import ws from 'ws'

dotenv.config()
neonConfig.webSocketConstructor = ws
const connectionString = `${process.env.DATABASE_URL}`

const pool = new Pool({ connectionString })
const adapter = new PrismaNeon(pool)
const prisma = new PrismaClient({ adapter })


Should process.env.DATABASE_URL be set to the pooler URL or the direct URL? Does using the adapter make the pooler unnecessary? Same question applies when using in Cloudflare.
Was this page helpful?