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:
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 monorepo9 Replies
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:
Then set PRISMA_OUT
to the absolute path before generating the client Link to GitHub issue.
2. Generate the client directly into node_modules:
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.I'm using 6.7.0
also unrelated I get a TS compile error
I assume you started getting this error after you upgraded to prisma 6.7.0, right?
Is your project open source?
yes and no
but it looks a lot like https://github.com/jetbridge/sst-prisma
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.
using 6.7.0 yes
hello
Could you try the new generator in addition to the query compiler preview feature? Just remove the
-js
from the generator namehere'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 lambdaGetting 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.