-
Notifications
You must be signed in to change notification settings - Fork 48
[BUG] Prisma throws Error: [unenv] fs.readdir is not implemented yet!
when querying
#623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
At least Hopefully #593 should help with that - it has not been released yet but you can try the OpenNext binary from the PR. You have to add the workerd specific packages to Hope this helps |
Appreciate the quick response! I've followed your suggestion and given the #593 binary a try and updated // `@prisma/client` and `pg` are included in the Next.js serverExternalPackages list and should
// automatically be opt-ed out
// https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/server-external-packages.json
const nextConfig: NextConfig = {
serverExternalPackages: ["@prisma/adapter-pg", "pg", "@prisma/client"],
}; |
No there is some other issue specific to prisma. Will have a PR for it tomorrow |
All working correctly for me after #628! |
@schweetheart thanks for reporting and of course thanks to @conico974 for fixing that! |
Even with #628 it's not working for me. I even tried upgrading to latest |
I have created a minimum reproducible - https://github.com/Noitidart/prisma-fail-cf-workers-nextjs Can try running
I attached a |
I am having this same issue when attempting to use Prisma with cf workers and NextJs. Any updates? My repository is here: https://github.com/BearTyree/Flash-Royale I have the driver adapters enabled in my prisma schema, why is prisma trying to access the fs on the edge? |
Remember to add this to your next config: const nextConfig: NextConfig = {
// note both the `@prisma/client` and `.prisma/client`
// you also want the adapters here
serverExternalPackages: ["@prisma/adapter-neon", "@neondatabase/serverless", "@prisma/client", ".prisma/client"],
}; |
Thanks @sommeeeer I did that here https://github.com/Noitidart/prisma-fail-cf-workers-nextjs/blob/master/next.config.ts But still same |
@Noitidart You are missing the |
Oh thank you! That fixed it! |
@sommeeeer I tried adding all of this to my I have pushed all of the changes I have made to try and fix this to my repo: https://github.com/BearTyree/Flash-Royale
|
@Noitidart are you doing anything other than that which is mentioned in this thread? |
@BearTyree check out tat minimal repo I posted. With just adding .prisma/client it fixed it |
@Noitidart Do you have any idea why this didn't work for my repo? Is d1 different? |
I'm not sure. |
i tried check out and edit config but keep same error |
Make sure to clean your folders before trying: Is you reproduction up-to-date? |
i re install last package and update node , run dev it okay , but keep error in deploy and preview . i spend fews day run prisma + cloudflare worker , it no hope . now i using drizzle , it run well . |
Prisma should work fine now for that adapter you are using. You most likely have something in your setup thats not right. Did you update your |
i tried from [1.0.0-beta.4] , [1.2.1] to [1.3.0] . |
You should create a new issue with a minimal reproduction then. |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
After following the Cloudflare workers with PostgreSQL tutorial.
When making a query via prisma client
Error: [unenv] fs.readdir is not implemented yet!
is thrown when running via the workers runtimepnpm preview
.When using a worker directly, Prisma works correctly.
Steps to reproduce
DATABASE_URL
in .env and .dev.vars with a postgres compatible database. (I used Neon)pnpm preview
http://localhost:3000/
Expected behavior
When running prisma directly in a worker without OpenNext, with the same code the result is working. When running the same code with OpenNext, the error is thrown.
Am I missing some configuration, or is there some unexpected behavior when the OpenNext build process interacts with Prisma.
@opennextjs/cloudflare version
1.0.0-beta.4
Wrangler version
4.14.0
next info output
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:47 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6000 Available memory (MB): 16384 Available CPU cores: 8 Binaries: Node: 20.11.1 npm: 10.8.1 Yarn: 1.22.19 pnpm: 9.15.0 Relevant Packages: next: 15.3.1 // Latest available version is detected (15.3.1). eslint-config-next: 15.3.1 react: 19.1.0 react-dom: 19.1.0 typescript: 5.8.3 Next.js Config: output: N/A
Additional context
Setting
PRISMA_CLIENT_FORCE_WASM=1
has had no effect. I also tested via the@prisma/adapter-neon
adapter with the same error.It looks like others have encountered the same error recently with different adapters.
The text was updated successfully, but these errors were encountered: