Closed joshma closed 1 year ago
I also got this error with next middleware:
next@13.2.4
, node@19.6.0
, @neondatabase/serverless@0.2.8
+1
Thanks guys. That's interesting. I can run locally (npm run dev
) without export const config = { runtime: "edge" }
, and I can run on Vercel with it, but I can't run locally with it. I'll need to set aside a bit of time to have a look at why that is.
I am also running into this 🤔 seems likely related to some Buffer
usage somewhere
OK. Driver version 0.2.9 should fix the immediate issue with Buffer
— but this just reveals a more serious underlying issue, which is that the Edge Runtime bundled with Next.js (and also with the Vercel CLI) doesn't yet support WebSockets for local development, even though Vercel does support them for deployed projects.
Neon and Vercel are both aware of this problem. I'll keep this issue open and keep you posted here.
Thanks for looking into this and for the info @jawj Is there a public Vercel/Next.js issue/PR/discussion we can all follow for progress on this on Vercel's end?
I created a minimal reproducable example on Stackblitz. I hope it's useful.
When I run npm run build
I get errors related to PostgresQueryCompiler.visitNode
.
This would be a really cool setup to support.
Probably an unrelated thing - kysely-neon
is just not able to construct an aggregate query. Doing a simple sql\
select 1`.execute(db)` yields a query but gives me:
unhandledRejection: Error: All attempts to open a WebSocket to connect to the database failed. If using Node, please install the `ws` package (or simply use the `pg` package instead).
... which I think has already been reported.
Happy to open another issue with the issue around aggregates and compiling queries.
The original issue here, which is that WebSockets aren't available with vercel dev
or next dev
, should now be resolved. Please shout if you're still having trouble, otherwise I'll close this issue.
Steps to reproduce
Errors on GET with:
Expected result
Any import seems to break
Actual result
Imports don't break
Environment
next@13.2.0
,node@16.14.2
,@neondatabase/serverless@0.2.8