P
Prisma13h ago
Niels

Module build failed: UnhandledSchemeError: Reading from "cloudflare:sockets" is not handled

For some reason, when I use the @prisma/adapter-pg and pass my Postgres connectionString, I get the following error? What could cause this? I'm just running locally using next dev?
○ Compiling /instrumentation ...
⨯ cloudflare:sockets
Module build failed: UnhandledSchemeError: Reading from "cloudflare:sockets" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "cloudflare:" URIs.
Import trace for requested module:
cloudflare:sockets
.../node_modules/pg-cloudflare/dist/index.js
.../node_modules/pg/lib/stream.js
.../node_modules/pg/lib/connection.js
.../node_modules/pg/lib/index.js
.../node_modules/pg/esm/index.mjs
.../node_modules/@prisma/adapter-pg/dist/index.mjs
./src/instrumentations/prisma/seeding.instrumentation.node.ts

[Error: An error occurred while loading instrumentation hook: Cannot find module '/path/to/project/.next/server/instrumentation'
Require stack:
- /path/to/project/node_modules/next/dist/server/dev/next-dev-server.js
- /path/to/project/node_modules/next/dist/server/next.js
- /path/to/project/node_modules/next/dist/server/lib/start-server.js] {
code: 'MODULE_NOT_FOUND',
requireStack: [Array]
}
○ Compiling /instrumentation ...
⨯ cloudflare:sockets
Module build failed: UnhandledSchemeError: Reading from "cloudflare:sockets" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "cloudflare:" URIs.
Import trace for requested module:
cloudflare:sockets
.../node_modules/pg-cloudflare/dist/index.js
.../node_modules/pg/lib/stream.js
.../node_modules/pg/lib/connection.js
.../node_modules/pg/lib/index.js
.../node_modules/pg/esm/index.mjs
.../node_modules/@prisma/adapter-pg/dist/index.mjs
./src/instrumentations/prisma/seeding.instrumentation.node.ts

[Error: An error occurred while loading instrumentation hook: Cannot find module '/path/to/project/.next/server/instrumentation'
Require stack:
- /path/to/project/node_modules/next/dist/server/dev/next-dev-server.js
- /path/to/project/node_modules/next/dist/server/next.js
- /path/to/project/node_modules/next/dist/server/lib/start-server.js] {
code: 'MODULE_NOT_FOUND',
requireStack: [Array]
}
I've just done it the way described in https://www.prisma.io/docs/orm/overview/databases/postgresql#using-the-node-postgres-driver
PostgreSQL database connector | Prisma Documentation
This page explains how Prisma can connect to a PostgreSQL database using the PostgreSQL database connector.
2 Replies
Prisma AI Help
Prisma AI Help13h ago
Greetings, curious mind! I'm the Prisma AI Help Bot. Want to chat with a human team member (ETA: TBD)? Or skip the wait and get my best guess right now? The speed of automation awaits you.
Niels
NielsOP13h ago
I noticed, as soon as I just import the import { PrismaPg } from "@prisma/adapter-pg"; it will fail. Even when not even instantiating it.

Did you find this page helpful?