neondatabase / serverless

Connect to Neon PostgreSQL from serverless/worker/edge functions
https://www.npmjs.com/package/@neondatabase/serverless
MIT License
343 stars 13 forks source link

Websocket connection failed #17

Closed IshanKBG closed 1 year ago

IshanKBG commented 1 year ago

Hey guys, It looks I am unable to connect to neondb locally. It shows a stacktrace error which says " All attempts to open a WebSocket to connect to the database failed." I am not sure what;s causing this error as i followed very step on the neon docs. Screenshot_2023-05-02_18-51-53

Here is the code

 import type { DB } from "kysely-codegen"
import { Pool } from "@neondatabase/serverless"
import { PostgresDialect, Kysely } from "kysely"
export const pool = new Pool({
  connectionString: "<string>"
})

export const db = new Kysely<DB>({
  dialect: new PostgresDialect({ pool })
})

I am using kysely and astro for my project This error is happening locally The deployment target is cloudflare

maccman commented 1 year ago

Are you on the latest version? They recently updated it.

jawj commented 1 year ago

Hi there. When you say you're connecting locally, do you mean you're using Node? If so, the link in the error message may have the answer?

IshanKBG commented 1 year ago

Hi there. When you say you're connecting locally, do you mean you're using Node? If so, the link in the error message may have the answer?

Yes i am using node I did follow the step but didn't work out I will retry again

jawj commented 1 year ago

@IshanKBG Are you still having trouble, or have you made this work now?