ErrorEvent
Steps to reproduce
import { Pool, neonConfig } from '@neondatabase/serverless';
...
const pool = new Pool({ connectionString: 'postgresql://postgres:password@localhost:54320/postgres' });
const result = await pool.query('SELECT id, name FROM sauna_location LIMIT 1');
Expected result
Returns rows from the database
Actual result
Throws ErrorEvent
Environment
Running in locally in MacOS, M2
ghcr.io/neondatabase/wsproxy:latest in Docker
"@neondatabase/serverless": "^0.10.4",
next.js 14.2.19
Vercel Edge runtime, servlerless function
Logs, links
ErrorEvent {
[Symbol(type)]: 'error',
[Symbol(kTarget)]: WebSocket {
[Symbol(kEvents)]: SafeMap(4) {
'error' => <ref *1> {
size: 1,
next: Listener {
next: undefined,
previous: [Circular *1],
listener: [Function],
flags: 0,
callback: [Function]
},
resistStopPropagation: false
},
'message' => <ref *2> {
size: 1,
next: Listener {
next: undefined,
previous: [Circular *2],
listener: [Function],
flags: 0,
callback: [Function]
},
resistStopPropagation: false
},
'close' => <ref *3> {
size: 1,
next: Listener {
next: undefined,
previous: [Circular *3],
listener: [Function],
flags: 0,
callback: [Function]
},
resistStopPropagation: false
},
'open' => <ref *4> {
size: 1,
next: Listener {
next: undefined,
previous: [Circular *4],
listener: [Function: handleWebSocketOpen],
flags: 0,
callback: [Function: handleWebSocketOpen]
},
resistStopPropagation: false
}
},
[Symbol(events.maxEventTargetListeners)]: 10,
[Symbol(events.maxEventTargetListenersWarned)]: false,
[Symbol(kHandlers)]: SafeMap(0) {},
[Symbol(url)]: URL { },
[Symbol(controller)]: Fetch {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: 21,
dispatcher: Agent {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
[Symbol(shapeMode)]: false,
[Symbol(kCapture)]: false,
[Symbol(destroyed)]: false,
[Symbol(onDestroyed)]: null,
[Symbol(closed)]: false,
[Symbol(onClosed)]: [],
[Symbol(dispatch interceptors)]: [ [Function] ],
[Symbol(options)]: { connect: undefined, interceptors: undefined },
[Symbol(maxRedirections)]: 0,
[Symbol(factory)]: [Function: defaultFactory],
[Symbol(clients)]: Map(1) { 'https://localhost' => WeakRef { } },
[Symbol(finalizer)]: { register: [Function: register] },
[Symbol(onDrain)]: [Function],
[Symbol(onConnect)]: [Function],
[Symbol(onDisconnect)]: [Function],
[Symbol(onConnectionError)]: [Function],
[Symbol(Intercepted Dispatch)]: [Function: Intercept]
},
connection: { abort: null, destroyed: true, destroy: [Function: destroy] },
dump: false,
state: 'terminated',
[Symbol(shapeMode)]: false,
[Symbol(kCapture)]: false
},
[Symbol(ready state)]: 0,
[Symbol(binary type)]: 'arraybuffer'
},
[Symbol(kIsBeingDispatched)]: false
}
I would like to use Neon with HTTP only. But cannot find any option to disable websockets. Also, would like to use it without a pool with multiple queries, but again only the one shot query function.
Thanks. Is this issue superseded by #127?
WebSockets shouldn't need to be disabled: simply don't use the Pool or Client objects and WebSockets will not be used.
IIUC the wsproxy Docker image can forward WebSocket traffic but does not offer an http API, so http queries (via import { neon }) are not available in a local development environment.
@jawj I need to use the Pool or Client with Kysely.