N
Neon11mo ago
other-emerald

Can't connect to Sydney region but can connect to EU using neon driver

Hi, I'm in EU, and I'm trying to connect to the Sydney region as that's where my main DB will live. I can connect using psql, but not the neon driver, it seems to timeout straight away. I'm trying to run drizzle-kit push I'm using Next.js locally to connect with drizzle ORM. Using a VPN connected to Syndey results in the same error Node version is 23.5 I've tried: 1. adding an agent to fetchOptions in the neon driver with an increased timeout 2. connectionTimeout=10 in url 3. using Pool connection Wondering if anyone else has experienced this issue and/or can help out, would greatly appreciate it. I can work around it, its just an annoyance. I can connect to EU no problem, but connecting to Sydney, I get the following error:
4 Replies
other-emerald
other-emeraldOP11mo ago
Using '@vercel/postgres' driver for database querying
Warning '@vercel/postgres' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket
ErrorEvent {
[Symbol(kTarget)]: WebSocket {
_events: [Object: null prototype] {
error: [Function],
message: [Function],
close: [Function],
open: [Function]
},
_eventsCount: 4,
_maxListeners: undefined,
_binaryType: 'arraybuffer',
_closeCode: 1006,
_closeFrameReceived: false,
_closeFrameSent: false,
_closeMessage: <Buffer >,
_closeTimer: null,
_errorEmitted: true,
_extensions: {},
_paused: false,
_protocol: '',
_readyState: 3,
_receiver: null,
_sender: null,
_socket: null,
_bufferedAmount: 0,
_isServer: false,
_redirects: 0,
_autoPong: true,
_url: 'wss://fake-neon-db-name-pooler.ap-southeast-2.aws.neon.tech/v2',
_req: null,
[Symbol(shapeMode)]: false,
[Symbol(kCapture)]: false
},
[Symbol(kType)]: 'error',
[Symbol(kError)]: AggregateError [ETIMEDOUT]:
at internalConnectMultiple (node:net:1139:18)
at internalConnectMultiple (node:net:1215:5)
at Timeout.internalConnectMultipleTimeout (node:net:1739:5)
at listOnTimeout (node:internal/timers:616:11)
at process.processTimers (node:internal/timers:549:7) {
code: 'ETIMEDOUT',
[errors]: [ [Error], [Error], [Error], [Error], [Error], [Error] ]
},
[Symbol(kMessage)]: ''
}
Using '@vercel/postgres' driver for database querying
Warning '@vercel/postgres' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket
ErrorEvent {
[Symbol(kTarget)]: WebSocket {
_events: [Object: null prototype] {
error: [Function],
message: [Function],
close: [Function],
open: [Function]
},
_eventsCount: 4,
_maxListeners: undefined,
_binaryType: 'arraybuffer',
_closeCode: 1006,
_closeFrameReceived: false,
_closeFrameSent: false,
_closeMessage: <Buffer >,
_closeTimer: null,
_errorEmitted: true,
_extensions: {},
_paused: false,
_protocol: '',
_readyState: 3,
_receiver: null,
_sender: null,
_socket: null,
_bufferedAmount: 0,
_isServer: false,
_redirects: 0,
_autoPong: true,
_url: 'wss://fake-neon-db-name-pooler.ap-southeast-2.aws.neon.tech/v2',
_req: null,
[Symbol(shapeMode)]: false,
[Symbol(kCapture)]: false
},
[Symbol(kType)]: 'error',
[Symbol(kError)]: AggregateError [ETIMEDOUT]:
at internalConnectMultiple (node:net:1139:18)
at internalConnectMultiple (node:net:1215:5)
at Timeout.internalConnectMultipleTimeout (node:net:1739:5)
at listOnTimeout (node:internal/timers:616:11)
at process.processTimers (node:internal/timers:549:7) {
code: 'ETIMEDOUT',
[errors]: [ [Error], [Error], [Error], [Error], [Error], [Error] ]
},
[Symbol(kMessage)]: ''
}
client code (don't think this is used for migrations):
import { neon } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/neon-http";

import * as schema from "./schema";

const sql = neon(process.env.DATABASE_URL!);

export const db = drizzle({
client: sql,
casing: "snake_case",
schema,
});
import { neon } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/neon-http";

import * as schema from "./schema";

const sql = neon(process.env.DATABASE_URL!);

export const db = drizzle({
client: sql,
casing: "snake_case",
schema,
});
Can connect using psql:
time psql "postgresql://fake-neon-db-name-southeast-2.aws.neon.tech/neondb?sslmode=require&options=endpoint%3Dep-curly-butterfly-a72ayjef" -c "SELECT version();"
version
---------------------------------------------------------------------------------------------------
PostgreSQL 16.6 on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
(1 row)


real 0m2.002s
user 0m0.034s
sys 0m0.014s
time psql "postgresql://fake-neon-db-name-southeast-2.aws.neon.tech/neondb?sslmode=require&options=endpoint%3Dep-curly-butterfly-a72ayjef" -c "SELECT version();"
version
---------------------------------------------------------------------------------------------------
PostgreSQL 16.6 on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
(1 row)


real 0m2.002s
user 0m0.034s
sys 0m0.014s
drizzle.config.ts
import type { Config } from "drizzle-kit";

if (!process.env.DATABASE_URL) {
throw new Error("Missing DATABASE_URL");
}

export default {
schema: "./src/schema",
out: "./migrations",
dialect: "postgresql",
dbCredentials: { url: process.env.DATABASE_URL },
casing: "snake_case",
} satisfies Config;
import type { Config } from "drizzle-kit";

if (!process.env.DATABASE_URL) {
throw new Error("Missing DATABASE_URL");
}

export default {
schema: "./src/schema",
out: "./migrations",
dialect: "postgresql",
dbCredentials: { url: process.env.DATABASE_URL },
casing: "snake_case",
} satisfies Config;
rare-sapphire
rare-sapphire11mo ago
Using a VPN connected to Syndey
This is likely what's preventing you from connecting
other-emerald
other-emeraldOP8mo ago
Sorry, I meant I tried using a VPN as a workaround and that didn't work either. My friend from Australia was able to connect to the instance, so it looks like a timeout issue from my end. Solution for me was temporarily disabling IPv6: sudo sysctl net.ipv6.conf.all.disable_ipv6=1 Can connect no problem now lol Took me an ungodly amount of debugging
other-emerald
other-emerald8mo ago
Sorry - I only just saw this. Yeah this is a common issues, nodejs has a terrible "happy eyeballs" implementation https://r1ch.net/blog/node-v20-aggregateeerror-etimedout-happy-eyeballs. @Daniel I think we should update our connection errors page with some more information on this

Did you find this page helpful?