Prisma 7 client fails on Cloudflare Workers: “Wasm code generation disallowed by embedder”
Bug description
On Cloudflare Workers (workerd via wrangler), any Prisma call with Prisma 7.0.0 crashes at startup with:
CompileError: WebAssembly.Module(): Wasm code generation disallowed by embedder Stack points to internal/class.ts -> getQueryCompilerWasmModule -> loadQueryCompiler -> ClientEngine.ts. Cloudflare blocks dynamic WASM compilation; Prisma 7 still compiles the query compiler WASM at runtime even when using the edge runtime and D1 adapter.
Even when forcing imports to @prisma/client/runtime/edge and stubbing fileURLToPath, the client still tries to compile WASM at runtime, which Cloudflare blocks. A Workers-compatible build that avoids dynamic WASM compilation is needed.
Severity
Critical: Data loss, app crash, security issue
Reproduction
- Prisma 7.0.0, generator client using provider = "prisma-client" and output to ../src/generated/prisma.
- Cloudflare Workers (wrangler dev), D1 with @prisma/adapter-d1.
- Start wrangler dev; POST to a route that triggers a Prisma query.
- Runtime error: CompileError: WebAssembly.Module(): Wasm code generation disallowed by embedder during client startup.
If you need a repo, I can share a minimal CF Worker + D1 + Prisma 7 setup; the failure is immediate on first request.
Expected vs. Actual Behavior
Expected: Prisma client loads and queries D1.
Actual: Worker crashes before query executes with WASM compile error.
Frequency
Consistently reproducible
Does this occur in development or production?
Both development and production
Is this a regression?
Yes. Prisma 6.19.0 worked on Workers; upgrading to 7.0.0 causes the crash.
Workaround
Only workaround: downgrade to Prisma 6.19.0 for Workers. No viable patch; stubbing fileURLToPath or importing the edge runtime does not stop the WASM compile path.
Prisma Schema & Queries
generator client {
provider = "prisma-client"
output = "../src/generated/prisma"
// (no special runtime flags)
}
datasource db {
provider = "sqlite"
url = env("DATABASE_URL") // D1
}
import { PrismaClient } from "./src/generated/prisma/client";
import { PrismaD1 } from "@prisma/adapter-d1";
export const prisma = new PrismaClient({ adapter: new PrismaD1(env.DB) });
await prisma.user.findMany();
Prisma Config
import { defineConfig } from "@prisma/config";
export default defineConfig({
datasources: {
db: { url: process.env.DATABASE_URL ?? "file:./dev.db" },
},
});
Logs & Debug Info
CompileError: WebAssembly.Module(): Wasm code generation disallowed by embedder
at decodeBase64AsWasm (.../libs/common/src/generated/prisma/internal/class.ts:36:10)
at async Object.getQueryCompilerWasmModule (.../internal/class.ts:44:12)
at async loadQueryCompiler (.../ClientEngine.ts:239:34)
...
clientVersion: '7.0.0'
Environment & Setup
- OS: macOS (dev)
- Database: Cloudflare D1 (SQLite)
- Node.js: v24.x (wrangler uses workerd)
- Runtime: Cloudflare Workers (workerd via wrangler dev)
Prisma Version
prisma : 7.0.0
@prisma/client : 7.0.0
@prisma/adapter-d1 : 7.0.0
Source: prisma/prisma