P
Prisma5mo 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
7 Replies
Prisma AI Help
Prisma AI Help5mo 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
NielsOP5mo ago
I noticed, as soon as I just import the import { PrismaPg } from "@prisma/adapter-pg"; it will fail. Even when not instantiating it.
Nurul
Nurul5mo ago
Is this happening on latest prisma version 6.7.0?
DevPanda
DevPanda5mo ago
yes
Trace Panic
Trace Panic5mo ago
yeah i just moved to 6.7 right now and when i try to build i get the same error
import { PrismaPg } from "@prisma/adapter-pg";
import { PrismaClient } from "@/prisma/generated";
import { env } from "@/env";

const adapter = new PrismaPg({ connectionString: env.DATABASE_URL });
const db = new PrismaClient({ adapter });
import { PrismaPg } from "@prisma/adapter-pg";
import { PrismaClient } from "@/prisma/generated";
import { env } from "@/env";

const adapter = new PrismaPg({ connectionString: env.DATABASE_URL });
const db = new PrismaClient({ adapter });
generator client {
provider = "prisma-client-js"
output = "../prisma/generated"
previewFeatures = ["queryCompiler", "driverAdapters"]
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
output = "../prisma/generated"
previewFeatures = ["queryCompiler", "driverAdapters"]
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
DevPanda
DevPanda5mo ago
i got the same
Niels
NielsOP4mo ago
Yes, sorry for replying late. Don't mind to ping me in follow up questions. Are there any updates on this? Is this something I'm experiencing on my own ?

Did you find this page helpful?