-
Notifications
You must be signed in to change notification settings - Fork 35
Error: Cannot find module '@prisma/client' in netlify functions when using prisma + next + rushjs + pnpm #636
Comments
I spent some time debugging this issue and here are my findings: Rush with PNPM doesn't install nested dependencies but prisma depends on
so, in node_modules of the project we have only "@prisma/client" because is symlinked by pnpm.
cannot find A potential fix is to manually add |
Yay, sorry but happy to see this issue. I'm getting this too. If I may add, local But while using pnpm monorepo, it ain't so easy to go back to npm structure |
I almost created another minimal repro without rush that self contains a SQLite file as database to test. But I didn't get it to work on Netlify, just locally. Anyway, the structure is the same as I get errors, if someone can give any idea to create this self-contained repro that works on netlify online. Or if this is already enough for the team to reproduce the error with a Database of your own online. |
Hi @abereghici! Thank you for providing a reproduction repository. It seems like |
@netlify-team-account-1 Sorry, there was a misconfiguration. I updated the repository. |
Thank you @abereghici! I think I was able to reproduce the error based on https://github.com/outerlook/netlify-prisma-nexus, I'll use your repository to verify a fix once we have it. |
* chore: add repro test for pnpm-style symlinking * chore: show that it works with esbuild-based bundlers Co-authored-by: Netlify Team Account 1 <netlify-team-account-1@users.noreply.github.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sorry to necro bump but is there a fix for this for regular |
Not sure what issue you're referring to - if there's already an issue for it in this repository, could you link it? If not, feel free to open one :) |
Turns out it's likely not this... and more to do with a js module trying to execute an |
Runtime.ImportModuleError - Error: Cannot find module '@prisma/client' Require stack: - /var/task/functions/allposts.js - /var/task/allposts.js - /var/runtime/index.mjs |
…/zip-it-and-ship-it#657) * chore: add repro test for pnpm-style symlinking * chore: show that it works with esbuild-based bundlers Co-authored-by: Netlify Team Account 1 <netlify-team-account-1@users.noreply.github.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Do you want to request a feature or report a bug?
🐞
- What is the current behavior?
In a rush monorepo with pnpm
@prisma/client
and.prisma
files aren't included in function node_modules and throw the error:- If the current behavior is a bug, please provide the steps to reproduce.
experimental-serverless-trace
.netlify/functions/
and see that@prisma/client
and.prisma
are not included in node_modulesIf you change the package manager from pnpm to npm then is working as expected.
I created a repository where you can reproduce the issue: https://github.com/abereghici/prisma-next-netlify-rush
- What is the expected behavior?
@prisma/client
and.prisma
files should be included innode_modules
when using pnpm.- Please mention your node.js, and operating system version.
The text was updated successfully, but these errors were encountered: