Edge/Cloudflare issue with new ts client: `Accelerate not set up` even if we definitely set it up

This is our stack: - Nuxt 4 app - Deployed on Cloudflare Workers - Prisma ORM + Prisma Postgres + Prisma Accelerate We are on the latest versions:
"@prisma/client": "^6.16.2",
"@prisma/extension-accelerate": "^2.0.2",
"prisma": "^6.16.2",
"@prisma/client": "^6.16.2",
"@prisma/extension-accelerate": "^2.0.2",
"prisma": "^6.16.2",
generator client {
provider = "prisma-client"
output = "generated"
runtime = "cloudflare"
}

datasource db {
provider = "postgresql"
url = env("NUXT_DATABASE_URL")
}
generator client {
provider = "prisma-client"
output = "generated"
runtime = "cloudflare"
}

datasource db {
provider = "postgresql"
url = env("NUXT_DATABASE_URL")
}
export function useDatabase(event: H3Event) {
const { databaseUrl } = useRuntimeConfig(event);
const prisma = new PrismaClient({ datasourceUrl: databaseUrl }).$extends(withAccelerate());
return prisma;
}
export function useDatabase(event: H3Event) {
const { databaseUrl } = useRuntimeConfig(event);
const prisma = new PrismaClient({ datasourceUrl: databaseUrl }).$extends(withAccelerate());
return prisma;
}
Now, whenever we run the app we get this error:
Invalid prisma... invocation:

Accelerate has not been setup correctly. Make sure your client is using .$extends(withAccelerate()). See https://pris.ly/d/accelerate-getting-started
Invalid prisma... invocation:

Accelerate has not been setup correctly. Make sure your client is using .$extends(withAccelerate()). See https://pris.ly/d/accelerate-getting-started
If we comment out the runtime = cloudflare line in schema.prisma, then the app works locally (with nuxt dev) but we get this error if we run it on Cloudflare environment (with wrangler dev after building it):
service core:user:my-case: Uncaught Error: No such module "node:tty".

at null.<anonymous> (index.js:72499:43)
at null.<anonymous> (index.js:72484:62)
at null.<anonymous> (index.js:72535:17)
at null.<anonymous> (index.js:72484:62)
at null.<anonymous> (index.js:73100:14) in .output/server/chunks/nitro/nitro.mjs
at null.<anonymous> (index.js:5:59) in __init
service core:user:my-case: Uncaught Error: No such module "node:tty".

at null.<anonymous> (index.js:72499:43)
at null.<anonymous> (index.js:72484:62)
at null.<anonymous> (index.js:72535:17)
at null.<anonymous> (index.js:72484:62)
at null.<anonymous> (index.js:73100:14) in .output/server/chunks/nitro/nitro.mjs
at null.<anonymous> (index.js:5:59) in __init
The only option that worked for us so far is to use the old JS client + avoiding specifying the output path like below (in which case it works both locally and on Cloudflare) + initializing the client from the /edge folder. In this case, we are still able to specify cloudflare as the runtime.
generator client {
provider = "prisma-client-js"
runtime = "cloudflare"
}
generator client {
provider = "prisma-client-js"
runtime = "cloudflare"
}
So are we able to use the new TS client with accelerate on the edge?
1 Reply
Prisma AI Help
You selected the carefully hand-crafted route. A dev artisan will respond soon. Meanwhile, the #ask-ai channel awaits if you're curious!

Did you find this page helpful?