P
Prisma5mo ago
mish

Wrong path for finding generated TS queryCompiler

I have prisma in a package in my monorepo. So in backend/ I have all the prisma setup. In backend/prisma/schema.prisma I have my schema:
generator client {
provider = "prisma-client-js"
previewFeatures = ["fullTextSearchPostgres", "postgresqlExtensions", "queryCompiler", "driverAdapters"]
output = "../src/prisma"
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["fullTextSearchPostgres", "postgresqlExtensions", "queryCompiler", "driverAdapters"]
output = "../src/prisma"
}
So it spits the client out in backend/src/prisma which is great When I run my app (I'm using SST for local lambda dev) I get: ENOENT: no such file or directory, open '/home/me/project/src/prisma/query_compiler_bg.wasm' But that should be backend/src/prisma not src/prisma So I'm not clear how to use this generator output in a monorepo
9 Replies
Prisma AI Help
Prisma AI Help5mo ago
You chose to compile with the bot. One moment while I piece together your answer… This issue is related to how Prisma tries to locate the schema file when using a custom output path in a monorepo setup. The problem you're experiencing is a known issue with Prisma's path resolution mechanism. When you specify a custom output path in your schema.prisma file, Prisma generates the client in that location, but at runtime, it may still look for certain files (like the WASM file) in incorrect locations. This happens because Prisma's internal path resolution logic sometimes struggles with monorepo setups. Based on the knowledge sources, there are several workarounds you could try: 1. Use environment variables to set the output path:
generator client {
provider = "prisma-client-js"
output = env("PRISMA_OUT")
}

generator client {
provider = "prisma-client-js"
output = env("PRISMA_OUT")
}

Then set PRISMA_OUT to the absolute path before generating the client Link to GitHub issue. 2. Generate the client directly into node_modules:
generator client {
provider = "prisma-client-js"
output = "../../../node_modules/@your-scope/prisma-client"
}

generator client {
provider = "prisma-client-js"
output = "../../../node_modules/@your-scope/prisma-client"
}

Then import from that package name Link to GitHub issue. 3. Multiple generator blocks for different output locations if you need the client in multiple places Link to GitHub issue. 4. Copy the schema.prisma file to the location where Prisma is looking for it (though this is more of a hack than a proper solution). The issue seems to be that Prisma is looking for files relative to the project root rather than relative to where the client was generated. This is a known limitation with custom output paths, especially in monorepo setups. If these workarounds don't solve your issue, you might need to open a new issue on the Prisma GitHub repository with a minimal reproduction of your specific setup. I'm limited in providing a definitive solution as the knowledge so urces don't address your exact scenario with the WASM file for query compiler, but these approaches have helped others with similar path resolution issues. 🤔 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.
mish
mishOP5mo ago
I'm using 6.7.0 also unrelated I get a TS compile error
RangeError: Maximum call stack size exceeded
at instantiateSignatures (/Users/cyber/dev/tombo/node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/_tsc.js:62330:33)
at resolveObjectTypeMembers (/Users/cyber/dev/tombo/node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/_tsc.js:56824:24)
at resolveTypeReferenceMembers (/Users/cyber/dev/tombo/node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/_tsc.js:56859:5)
RangeError: Maximum call stack size exceeded
at instantiateSignatures (/Users/cyber/dev/tombo/node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/_tsc.js:62330:33)
at resolveObjectTypeMembers (/Users/cyber/dev/tombo/node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/_tsc.js:56824:24)
at resolveTypeReferenceMembers (/Users/cyber/dev/tombo/node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/_tsc.js:56859:5)
Nurul
Nurul5mo ago
I assume you started getting this error after you upgraded to prisma 6.7.0, right? Is your project open source?
mish
mishOP5mo ago
yes and no
mish
mishOP5mo ago
GitHub
GitHub - jetbridge/sst-prisma: Serverless Stack + Prisma ORM Template
Serverless Stack + Prisma ORM Template. Contribute to jetbridge/sst-prisma development by creating an account on GitHub.
mish
mishOP5mo ago
using 6.7.0 yes hello
jonfanz
jonfanz5mo ago
Could you try the new generator in addition to the query compiler preview feature? Just remove the -js from the generator name
mish
mishOP4mo ago
here's what i get now: Error: ENOENT: no such file or directory, open '/var/task/prisma_schema_build_bg.wasm' and Invalid prisma.user.findUnique() invocation: Cannot find module '@prisma/client/runtime/query_compiler_bg.postgresql.wasm' Require stack: - /var/task/backend/src/cognito/triggers/preTokenGeneration.mjs running on lambda
mr nooli
mr nooli3mo ago
Getting this issue also! @Jon Harrell if I remove the -js from the generator name then I get a huge list of errors saying 'can't resolve "..."'. client.js is a lot of them some enums etc.

Did you find this page helpful?