#Upgrade to queryCompiler & driverAdapters in a turborepo causes errors

16 messages · Page 1 of 1 (latest)

torn zenith
clever wyvernBOT
#

Skipping coffee for instant knowledge! Let's brew that AI answer now.

clever wyvernBOT
# clever wyvern 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 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:

    config.dirname = path.join(process.cwd(), alternativePath)
    

    Manually changing this to point to your monorepo path can fix it:

    config.dirname = path.join('/path/to/monorepo', alternativePath)
    

    However, this is impractical as it requires modifying generated code after each build.

  2. Package reinstallation: Another user reported success with:

    bun r @prisma/client
    bun i @prisma/client -f
    bunx prisma generate
    
  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.

clever wyvernBOT
rare island
#

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 😅

final lark
crystal turtle
torn zenith
#

@crystal turtle 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!
rare island
#

@torn zenith Do you have a repo you could share? Id love to see your setup if you've been able to get things working

torn zenith
rare island
#

Tried that, my comment is the one below

torn zenith
# rare island 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*

rare island
#

I'll give that a try, thanks!

rare island
#

Wow that was all I needed 😅 . Really appreciate you following up!

rare island
#

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?