Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ErrorEvent #126

Open
tapz opened this issue Dec 4, 2024 · 3 comments
Open

ErrorEvent #126

tapz opened this issue Dec 4, 2024 · 3 comments

Comments

@tapz
Copy link

tapz commented Dec 4, 2024

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
}
@tapz
Copy link
Author

tapz commented Dec 4, 2024

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.

@jawj
Copy link
Collaborator

jawj commented Dec 5, 2024

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.

@tapz
Copy link
Author

tapz commented Dec 6, 2024

@jawj I need to use the Pool or Client with Kysely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants