Upgrade to queryCompiler & driverAdapters in a turborepo causes errors
I am looking to upgrade and use queryCompiler + driverAdapters but am hitting this issue: https://github.com/prisma/prisma/issues/27083
Is anyone aware of a workaround or fix for this?
GitHub
Prisma Postgres Adapter with Turborepo does not work Β· Issue #2708...
Bug description if I have a turborepo monorepo with a packages/db folder containing my prisma schema, and a apps/web application (Next.JS) and I use the updated prisma with previewFeatures = ["...
11 Replies
Skipping coffee for instant knowledge! Let's brew that AI answer now.
I'm aware of the issue you're facing with Prisma's queryCompiler and driverAdapters in a Turborepo setup. This is a known issue tracked in GitHub issue #27083.
The problem occurs because Prisma is looking for the WASM file in the wrong location. When using queryCompiler + driverAdapters in a monorepo, Prisma incorrectly looks for
Manually changing this to point to your monorepo path can fix it:
However, this is impractical as it requires modifying generated code after each build. 2. Package reinstallation: Another user reported success with: 3. Disable queryCompiler: The most reliable workaround is to remove the
query_compiler_bg.wasm in your app directory (e.g., /apps/web/) instead of where it's actually located in your database package.
There are a few workarounds mentioned in the issue:
1. Manual fix (temporary): One user found that the issue is in the generated client's index.js file, which contains:
Manually changing this to point to your monorepo path can fix it:
However, this is impractical as it requires modifying generated code after each build. 2. Package reinstallation: Another user reported success with: 3. Disable queryCompiler: The most reliable workaround is to remove the
queryCompiler feature flag while keeping driverAdapters. Several users confirmed this works.
The issue is still open as of Prisma 6.9.0, and there's no official fix yet. The Prisma team is aware of the problem, but if you need a working solution now, disabling the queryCompiler feature while keeping driverAdapters seems to be the most reliable approach.
This appears to be related to how Prisma resolves paths in a monorepo structure when using these preview features together.
π€ Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly.
In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.Running into the same issue myself. All the suggestions say to use the nextjs monorepo plugin, but I'm using TanStack Start.
The docs are no help, they suggest 5 unique approaches between prisma-client, prisma-client-js, vercel, turborepo, etc... none of which seems to work
I know I'm not owed anything, but prisma has been really difficult to use in these last few updates π
I agree, but all the other ORMs are worse so itβs worth persisting through
Hey!
Can you try this workaround and see if you still get any errors? π
https://github.com/prisma/prisma/issues/27083#issuecomment-2979398021
GitHub
Prisma Postgres Adapter with Turborepo does not work Β· Issue #2708...
Bug description if I have a turborepo monorepo with a packages/db folder containing my prisma schema, and a apps/web application (Next.JS) and I use the updated prisma with previewFeatures = ["...
@Nurul (Prisma) The workaround to remove the output worked. But I did run into a separate issue when attempting to deploy. Maybe you can provide some clarity here:
The new queryCompiler + driverAdapters features offer benefits (Rust-free architecture, better performance, smaller bundles), but they're incompatible with Prisma Accelerate since Accelerate requires prisma:// URLs while driver adapters need direct connection strings. This means Accelerate users are locked out of the new architecture benefits. Are there any plans on the roadmap to make these work together? For example:
- Rebuilding Accelerate to work as a driver adapter
- Supporting prisma:// URLs in the query compiler
- Or any other approach?
Many of us would like to use both Accelerate's caching/pooling AND the new Rust-free architecture.
Any insights on timing or approach would be helpful!
@Ryan Do you have a repo you could share? Id love to see your setup if you've been able to get things working
The workaround is outlined in this comment: https://github.com/prisma/prisma/issues/27083#issuecomment-2979398021
"Remove the output path in you generator config and import the generated client from @prisma/client."
Tried that, my comment is the one below
You may need to ensure that @prisma/client is hoisted to the root of your repo in node_modules, manually inspect your node_modules and check. The client should not be nested in packages/database.
I have a .npmrc and use
shamefully-hoist=true public-hoist-pattern[]=*prisma*I'll give that a try, thanks!
Wow that was all I needed π
. Really appreciate you following up!
Hm, so I'm running into some really inexplicable issues still. Made a few changes started getting
Undid those changes, same error. Swapped to using
prisma-client-js with no output, back to working. Reverted that back to prisma-client, still working. I have no explaination. Could it something related to Vercel/the build cache?@Nurul Would love if you could shed some light on this question about how accelerate and rust free architecture fit together, thanks!