N
Neon2y ago
genetic-orange

NeonDbError: Error connecting to database: Unable to connect. Is the computer able to access the url

When i use bun with drizzle and neon, i'm getting this error on data fetching after few minutes. I tried this example to solve the problem but the result is the same https://github.com/neondatabase/drizzle-overview/tree/main
GitHub
GitHub - neondatabase/drizzle-overview: Demo Drizzle ORM, Hono & Ne...
Demo Drizzle ORM, Hono & Neon API. Contribute to neondatabase/drizzle-overview development by creating an account on GitHub.
5 Replies
genetic-orange
genetic-orangeOP2y ago
I tested this issue with windows instead of linux mint and error is gone ._. I was using cloudflare warp to change my DNS and it was not working properly along with bun and drizzle because I left it on. I solved the problem by switching off the warp.
extended-salmon
extended-salmon2y ago
Glad to hear that the issue was solved. I'm not sure why you were getting an error though If you turn Cloudflare WARP back on, does the issue happen again?
xenial-black
xenial-black2y ago
This is interesting, because we had a user in the past with the opposite issue. They had to use warp to connect to us-west from Singapore (I think)
ambitious-aqua
ambitious-aqua5mo ago
Hi team, I am experiencing this error all of sudden. Previously it was working well, but now I am getting this error. Anything should I do? This is how I setup neon
// For public connection
const sql = () => {
printLog("NEON_DATABASE_URL: ", Bun.env.NEON_DATABASE_URL)
return neon(Bun.env.NEON_DATABASE_URL ?? "")
}
const db = drizzle({
client: sql(),
schema: { users, payments, iplPayments, iplPaymentMonths },
logger: new MyLogger(),
})

// For authenticated connection
const authenticatedSql = (authToken: string) => {
printLog("NEON_DATABASE_AUTHENTICATED_URL: ", Bun.env.NEON_DATABASE_AUTHENTICATED_URL)
return neon(Bun.env.NEON_DATABASE_AUTHENTICATED_URL ?? "", {
authToken: authToken,
})
}
const authenticatedDb = (authToken: string) =>
drizzle({
client: authenticatedSql(authToken),
schema: { users, payments, iplPayments, iplPaymentMonths },
logger: new MyLogger(),
})
// For public connection
const sql = () => {
printLog("NEON_DATABASE_URL: ", Bun.env.NEON_DATABASE_URL)
return neon(Bun.env.NEON_DATABASE_URL ?? "")
}
const db = drizzle({
client: sql(),
schema: { users, payments, iplPayments, iplPaymentMonths },
logger: new MyLogger(),
})

// For authenticated connection
const authenticatedSql = (authToken: string) => {
printLog("NEON_DATABASE_AUTHENTICATED_URL: ", Bun.env.NEON_DATABASE_AUTHENTICATED_URL)
return neon(Bun.env.NEON_DATABASE_AUTHENTICATED_URL ?? "", {
authToken: authToken,
})
}
const authenticatedDb = (authToken: string) =>
drizzle({
client: authenticatedSql(authToken),
schema: { users, payments, iplPayments, iplPaymentMonths },
logger: new MyLogger(),
})
This only happen if I am using connection string of "authenticated" role.
sunny-green
sunny-green5mo ago
Same issue for me as well. It stopped working all of a sudden. I checked everything, everything is right.

Did you find this page helpful?