-
Notifications
You must be signed in to change notification settings - Fork 587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rush] Deploy problems with Prisma as dependency #2676
Comments
This sounds like an issue with Prisma. Can you open an issue there to fix this behavior? |
On their side it's not an issue, it's a "policy". https://www.prisma.io/docs/concepts/components/prisma-client/working-with-prismaclient/generating-prisma-client#why-is-prisma-client-generated-into-node_modulesprismaclient-by-default If you can link to any rules they're breaking by doing that I can try my luck there, I guess, but I doubt anything will come out of it. I've found my workaround by regenerating the client again after I do the deploy, but I thought this might be worth a discussion anyway. (since it feels like things shouldn't be touched after the deploy, if possible). |
This issue also arises when developing.
Manual fix: It would be nice to have a way to execute a command after a rush update (which removes .prisma/client). |
May be you can generate |
Unfortunately even if you generate the main client in a custom directory, it still creates a stub in the usual place |
I also had to restart my IDE (VS Code) after |
I had this same issue. Found a solution but it's ugly and am looking for a proper solution answer. Anyway my current 'solution' is to find where the node resolver locates @prisma/client within rush's pnpm library and generate my schema there as well as in the default location. generator client {
provider = "prisma-client-js"
output = "../node_modules/.prisma/client"
// output = "../../../common/temp/node_modules/.pnpm/@prisma+client@4.9.0_prisma@4.9.0/node_modules/.prisma/client"
// output = "../../../common/temp/node_modules/.pnpm/@prisma+client@4.9.0/node_modules/.prisma/client"
} So just rerunning Some extra context in case it helps: I suspect this isn't necessarily a rush issue but I could be wrong and have no idea whether the solution would reside with rush, prisma or next :') |
Well, what we ended up doing, is treating Prisma schema as source, output to custom dir and re-export the result as a separate package ( At the same time we got rid of dependencies that tried to work with Prisma by doing |
Interesting approach... can see how that would work. My setup is kind of similar but methodology is different. So you can understand why exporting the generated prisma client in a package doesn't make sense from my use case, but if its purpose was to be a reusable client that doesn't need to change then your appoach makes perfect sense, and it's good to know that it's a workable option! If you learn anything new please keep us in the loop, and I'll do the same. |
One last thing to note -- this might have already been touched on, but I can confirm that this is only a problem when using pnpm/rush. |
What is the status of this? Will this be prioritized ? |
Over the years we have struggled with many different NPM packages that want a place to cache data, and decide that
@Cmoen11 from this GitHub issue, it's unclear what is being asked of Rush. One idea would be for deploy.json /**
* Specifies a list of additional folder paths that will be included in the "rush deploy" output folder.
*/
"additionalFoldersToInclude": [
// How is this maintainable? The folder path can change with any "rush update"
"common/temp/node_modules/.pnpm/@prisma+client@2.11.0_@prisma+cli@2.11.0/node_modules/.prisma"
] I think a better solution is to redirect Prisma's output into a more manageable location.
The "policy" that linked from the Prisma documentation ("Keeping the query engine out of version control by default") is really describing a requirement, not an implementation. They also call it a "default" suggesting that they are open to other solutions. I think the ideal would be something like:
|
Thank you @octogonz for the great answer that gives us an well written explanation. I think a way to flag certain folders as a cache-folder-thing would be a great addition, as in my case, if i ran rush update in any of the different project within the mono repo it would wipe the prisma cache.. so a way to keep this would be awesome. I read this answer: netlify/zip-it-and-ship-it#636 (comment) I'll test this and give a feedback. thank you again for the quick response! |
To be fair, in 3 years I ran monorepo at that company, Prisma was the only project needing special treatment for deploy (but we did find a good way, already described above) |
Summary
I can't deploy an app that depends on Prisma because prisma client doesn't get copied over
Repro steps
rush update
rush build
rush deploy
Look into
common/temp/node_modules/.pnpm/@prisma+client@2.11.0_@prisma+cli@2.11.0/node_modules/
, see.prisma
folderLook into
common/deploy/common/temp/node_modules/.pnpm/@prisma+client@2.11.0_@prisma+cli@2.11.0/node_modules/
, don't see.prisma
folderDetails
The problem is basically that Prisma guys are being smart
a... guys. The prisma client is being generated in apostinstall
hook of the package (or withnpx prisma generate
, whatever), however it's generated outside of the main package folder. So, when deploy happens, the hook doesn't run, obviously - files are just copied over, but,.prisma
doesn't get copied over as well, because it's neither a dependency from anything'spackage.json
, nor is it in a folder of any dependency.Standard questions
Please answer these questions to help us investigate your issue more quickly:
@microsoft/rush
globally installed version?rushVersion
from rush.json?useWorkspaces
from rush.json?node -v
)?The text was updated successfully, but these errors were encountered: