can't connect to database in Netflify after adding drizzle, even though it works in localhost

Hello all, I have a sveltekit application (supabase as database, using drizzle as orm) that is working flawlessly in my local machine. However, after my last deploy in which I implemented Drizzle orm as opposed to using supabase api directly, it is completely broke in Netflify. Not only do my endpoints return an error when calling them, but some pages are simply not available and throw a not found error. I suspect in might be related that might not be working for some reason, but so far I haven't found a solution. I even tried to deploy it to vercel, but the exact same error occurred. Any idea on what might be causing this? Thank you
1 Reply
frankscp
frankscpOP10mo ago
Can it be related to how I'm creating my database connection client? I saw a few discussions on it
import {DIRECT_URL } from '$env/static/private';
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
const connectionString = DIRECT_URL;
// Disable prefetch as it is not supported for "Transaction" pool mode
const client = postgres(connectionString, { prepare: false });
export const db = drizzle(client);
import {DIRECT_URL } from '$env/static/private';
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
const connectionString = DIRECT_URL;
// Disable prefetch as it is not supported for "Transaction" pool mode
const client = postgres(connectionString, { prepare: false });
export const db = drizzle(client);
Error log:
Error: getaddrinfo ENOTFOUND {myDatabaseHostURL}
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26)
at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:128:17) {
errno: -3007,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: {myDatabaseHostURL}
}
Error: getaddrinfo ENOTFOUND {myDatabaseHostURL}
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26)
at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:128:17) {
errno: -3007,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: {myDatabaseHostURL}
}
Want results from more Discord servers?
Add your server