P
Prisma7mo ago
Dhcdec

When using the @prisma/adapter-pg I get a module build fail trying to use the prisma client.

I have a turborepo next 14 monorepo that exports the prisma client into my front and back end apps from the database package. I have all my prisma dependencies installed there. I am getting:
Module build failed: UnhandledSchemeError: Reading from "cloudflare:sockets" is not handled by plugins (Unhandled scheme).
Module build failed: UnhandledSchemeError: Reading from "cloudflare:sockets" is not handled by plugins (Unhandled scheme).
Could this have to do with monorepo set up? and not having the postgres installed adapter in the front/back -end folders?
3 Replies
Prisma AI Help
Prisma AI Help7mo ago
You decided to hold for human wisdom. We'll chime in soon! Meanwhile, #ask-ai is there if you need a quick second opinion.
Dhcdec
DhcdecOP7mo ago
here is my client.ts:
import { PrismaClient } from './prisma/generated/client'
import { PrismaPg } from '@prisma/adapter-pg'

const adapter = new PrismaPg({
connectionString: process.env.DATABASE_URL,
ssl: {
rejectUnauthorized: process.env.NODE_ENV === 'production'
}
})

export const prisma = new PrismaClient({ adapter })
import { PrismaClient } from './prisma/generated/client'
import { PrismaPg } from '@prisma/adapter-pg'

const adapter = new PrismaPg({
connectionString: process.env.DATABASE_URL,
ssl: {
rejectUnauthorized: process.env.NODE_ENV === 'production'
}
})

export const prisma = new PrismaClient({ adapter })
I installed pg in my frontend package and that brought to another issue,
Error: ENOENT: no such file or directory, open 'C:\Users\x-1\OneDrive\Documents\Projects\x\x1\apps\frontend\src\prisma\generated\client\query_compiler_bg.wasm'
Error: ENOENT: no such file or directory, open 'C:\Users\x-1\OneDrive\Documents\Projects\x\x1\apps\frontend\src\prisma\generated\client\query_compiler_bg.wasm'
The generated client is in the database folder, it shouldnt b looking for it in the frontend actually im not sure it is wrong for it to be trying to get it from fronted, but it isnt finding it either way Yeah the actual issue is that the generated prisma file is not available at runtime in my monrepo for some reason
Nurul
Nurul6mo ago
Hey! I believe you are generating PrismaClient at a custom location by setting output path. Can you temporarily comment out the output path and check if generating PrismaClient at the default location (inside node_modules) fixes the issue for you?

Did you find this page helpful?