Open kachar opened 8 months ago
I think the problem is the Turborepo setup is storing the cached generated Prisma code in an unexpected place. The Turborepo docs say:
Prisma behaves differently with different package managers. This can lead to unpredictable results, which might lead to broken deployments in some situations. Instead of documenting the intricacies of each approach, we recommend not caching the results of prisma generate.
Actually I think it's not just Turborepo. Prisma has an output option to change the location of the generated Prisma client, but relations.ts is always trying to load it from the default location.
Here's how a similar extension solves this same issue: https://github.com/47ng/prisma-field-encryption?tab=readme-ov-file#custom-prisma-client-location
I looked at the this
object passed to the extension by Prisma, and also the result of Prisma.getExtensionContext(this)
, but neither of them expose the DMMF as far as I can tell - I think the fix needs to be the same I linked above with the prisma-field-encryption
extension: optionally pass in the DMMF.
@olivierwilkinson would you accept a patch to add this?
Running into the same issue
I also run into the same issue while trying to use prisma-extension-soft-delete with custom Prisma client location
We've stumbled upon the following error when we've introduced
"prisma-extension-soft-delete": "1.0.0",
in our app.I'm raising the issue in this repo since the error is located in the
prisma-extension-nested-operations
code.We're using turborepo and the lib is loaded from a sub-package located at
packages/db/schema.prisma
However the main app is unable to load the dependencies.The prisma schema is generated, all migrations are applied.