Cloudflare DevelopersCD
Cloudflare Developers7mo ago
1 reply
bear

Prisma with D1 NextJs and CF Workers

I am trying to use Prisma ORM with D1 in NextJs on Cloudflare Workers. This works when running npm run dev. However, as soon as I attempt to use npm run preview or npm run deploy my website breaks and returns the following error when I try to use any server functions. I believe this has something to do with prisma since it is trying to access the file system, but I have driverAdapters enabled so prisma should work on the edge. Could this have anything to do with opennext, and if so how can I fix it?
my repo is: https://github.com/BearTyree/Flash-Royale
the error is:
Error: [unenv] fs.readdir is not implemented yet!
    at createNotImplementedError (file:///H:/Git/flash-royale/node_modules/unenv/dist/runtime/_internal/utils.mjs:25:9)
    at Object.fn [as readdir] (file:///H:/Git/flash-royale/node_modules/unenv/dist/runtime/_internal/utils.mjs:30:9)
    at nc (file:///H:/Git/flash-royale/.open-next/server-functions/default/handler.mjs:337:2096)
    at Ko (file:///H:/Git/flash-royale/.open-next/server-functions/default/handler.mjs:337:2026)
    at tc (file:///H:/Git/flash-royale/.open-next/server-functions/default/handler.mjs:337:1491)
    at async Zo (file:///H:/Git/flash-royale/.open-next/server-functions/default/handler.mjs:336:7116)
    at async es (file:///H:/Git/flash-royale/.open-next/server-functions/default/handler.mjs:337:2477)
    at async ir (file:///H:/Git/flash-royale/.open-next/server-functions/default/handler.mjs:337:2260)
    at async Gr.getCurrentBinaryTarget (file:///H:/Git/flash-royale/.open-next/server-functions/default/handler.mjs:443:13360)
    at async Gr.instantiateLibrary (file:///H:/Git/flash-royale/.open-next/server-functions/default/handler.mjs:443:13148) {
  clientVersion: '6.9.0'
}
[wrangler:info] POST /signup 200 OK (21ms)
Was this page helpful?