aleemrehmtulla
DTDrizzle Team
•Created by aleemrehmtulla on 7/16/2023 in #help
neon coldstarts in vercel edge
hey!! if my neondb is in
idle
state, and i try to query something -- it will error out.
- error node_modules/@neondatabase/serverless/index.js (1527:67) @ eval
- error error connecting to server: Connection refused (os error 111)
Caused by:
Connection refused (os error 111)
then if i try again after it's active -- works all good
how can i write it in a way to wait for db to activate?
context:
neonConfig.fetchConnectionCache = true
const sql = neon(process.env.DATABASE_URL!)
export const db = drizzle(sql)
const test = await db.select().from(kyteProd).where(eq(kyteProd.username, id)).then(takeFirst)
(same happens without fetchConnectionCache
)2 replies