neondatabase / serverless

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

Connect to wss without wsproxy #4

Closed petuhovskiy closed 1 year ago

petuhovskiy commented 1 year ago

Needed to work on https://github.com/neondatabase/neon/issues/3225

petuhovskiy commented 1 year ago

I don't think it's ready to merge to main yet, but it can be merged to no-webassembly branch, and you can continue your work there.

What should be fixed before merging to main:

In other words, this code is not yet ready to use and shouldn't be in main yet. WDYT @jawj?

jawj commented 1 year ago

@petuhovskiy Sure, it's fine to stick to the no-webassembly branch (and we certainly shouldn't publish to npm yet).

How soon do you think we could deploy to staging?

petuhovskiy commented 1 year ago

I want to get a proxy review from @funbringer, probably make some fixes and then we can merge and deploy it. I think it should get to staging around next week.

jawj commented 1 year ago

OK. We've more or less promised Vercel to launch it next week, so it would be great if we could deploy to staging early in the week (and to production by the end of the week?).

kelvich commented 1 year ago

wss proxy is on staging now. @petuhovskiy can you rebase this?

petuhovskiy commented 1 year ago

Sorry, forgot to update this PR. Will rebase it now.

petuhovskiy commented 1 year ago

Updated the PR, I used my staging db in all variables at .dev.vars

nicksrandall commented 1 year ago

Is it possible yet for me to test this? I'm working on a POC and want to get a ballpark measurement on what latency is like with the new proxy.

kelvich commented 1 year ago

@nicksrandall we are still doing some work to reduce the latency (mainly around making authentication quicker in happy path https://github.com/neondatabase/neon/pull/3331), hence no public release yet. However, things from this PR are already implemented in no-webassembly branch and published in temporary @jawj/test-serverless npm package. Proxy with websockets is on prod in all regions, so feel free to test it. @jawj/test-serverless will switch to websockets if it detects neon.tech in connection string. Here is an example: https://github.com/jawj/edge-data-latency-mine/blob/main/pages/api/neon-global.ts#L13-L23

Curious to see your results.

(This PR is ought to be closed, but i'll keep it open for now to keep this discussion)

jawj commented 1 year ago

OK, equivalent changes have now been made, merged in, and released to npm as a new version of @neondatabase/serverless, therefore closing.

https://community.neon.tech/ may be useful for further discussion.