any idea why querying directly to neon is faster than doing it thorugh hyperdrive?
any idea why querying directly to neon is faster than doing it thorugh hyperdrive?
wrangler dev) does not currently support connecting to remote databases that require SSL. It is a known gap that we are hoping to address in the future.docker run -d -e POSTGRES_PASSWORD=password -p 5433:5432 postgres:16 -c ssl=on -c ssl_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem -c ssl_key_file=/etc/ssl/private/ssl-cert-snakeoil.key)wrangler dev --remote which spawns an ephemeral Worker and will behave like a normal Worker. Still wants a localConnectionString but will use the Hyperdrive binding you give it instead.sslmode=disable (this is probably the hardest to mange given I don't think Supabase supports that)env in the request, but in my project drizzle configuration is defined in a separate file:const db = createDrizzle(env.HYPERDRIVE_URL, env.SSL) where you need to use it.prepare: false. We've optimized a bit for the defaults postgres.js uses, so prepare: true will generally be preferable. Especially if you have caching enabled.docker run -d -e POSTGRES_PASSWORD=password -p 5433:5432 postgres:16 -c ssl=on -c ssl_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem -c ssl_key_file=/etc/ssl/private/ssl-cert-snakeoil.keywrangler dev --remotelocalConnectionStringsslmode=disable[wrangler:inf] GET ... 500 Internal Server Error (30722ms)
Error: write CONNECT_TIMEOUT ...:5432
at RG (file:///Users//.wrangler/tmp/dev-pvRk1H/index.js:67:18734)
at n (file:///Users//.wrangler/tmp/dev-pvRk1H/index.js:78:3715)
at cachedError (file:///Users//.wrangler/tmp/dev-pvRk1H/index.js:67:6484)
at new Query (file:///Users//.wrangler/tmp/dev-pvRk1H/index.js:67:4794)
at Ve (file:///Users//.wrangler/tmp/dev-pvRk1H/index.js:88:1506)
at getTemplateRules (file:///Users//.wrangler/tmp/dev-pvRk1H/index.js:769:3897) {
code: CONNECT_TIMEOUT,
errno: CONNECT_TIMEOUT,
address: ...,
port: 5432,
stack: Error: write CONNECT_TIMEOUT .../.wrangler/tmp/dev-pvRk1H/index.js:769:3897)
...
}const client = postgres(process.env.db || DATABASE_URL, {
ssl: DATABASE_SSL === 'true',
prepare: false
});
export const db = drizzle(client, { schema });const db = createDrizzle(env.HYPERDRIVE_URL, env.SSL)prepare: falseprepare: trueexport const createDrizzle = (url: string, ssl: boolean) => {
const db = postgres(url, {
ssl
});
return drizzle(client, { schema });
};