Open fullyDeepak opened 6 months ago
Same here, except I'm not even deploying on Cloudflare, it gives me the same error on my local machine when using the edge runtime (especially in middleware.ts when using NextJS 14 app router)
UPDATE: it seems that when using postgres
in an edge environment, the only supported runtime is the Cloudflare Workers one, it fails everywhere else.
In the cf implementation it polyfills the Socket.connect() function with an explicit await import('cloudflare:sockets')
.
IMHO the edge implementation should be abstracted, for example using @arrowood.dev/socket
to polyfill TCP sockets.
connection.ts
using in route.ts
Error