Help Needed: `UnhandledSchemeError: cloudflare:sockets` with Drizzle ORM and `runtime = "edge"`
Hi Drizzle community,
I'm running into a problem while trying to deploy my Next.js API routes using Drizzle ORM with PostgreSQL. Everything works fine locally, but when I set
export const runtime = "edge";
, I encounter the following error during compilation:
My Setup:
- Framework: Next.js
- Database: PostgreSQL
- ORM: Drizzle ORM with postgres
package
- Runtime: edge
(Cloudflare Workers)
- Key Code Snippet:
Issue Summary:
The error seems to stem from the postgres
package when trying to use the edge runtime with Cloudflare Workers. It appears that Webpack cannot handle the cloudflare:
scheme used in postgres/cf/polyfills.js
.
Questions:
1. Has anyone else encountered this problem when using Drizzle ORM with Cloudflare Workers and the runtime = "edge"
setting?
2. Is there a recommended approach for using Drizzle ORM with PostgreSQL in Cloudflare Workers?
Any advice or suggestions would be greatly appreciated!
Thanks in advance for your help!0 Replies