#Prisma, NextJs and Cloudflare FS error no matter what I do

1 messages · Page 1 of 1 (latest)

glossy pilot
#

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.
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)
iron shellBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

glossy pilot
#

For anyone finding this in the future:
The solution is to either not use windows, or not use prisma.
https://github.com/sommeeeer was able to get my repo working on linux after wiping the folders rm -rf .next .open-next .wrangler node_modules and trying again.
I was able to get drizzle working on windows in dev and preview so I recommend using that instead of prisma if you are on windows.

iron shellBOT