-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
@prisma/nextjs-monorepo-workaround-plugin
is not able to handle multiple clients
#18069
Comments
@prisma/webpack-plugin
is not able to handle multiple clients@prisma/nextjs-monorepo-workaround-plugin
is not able to handle multiple clients
For a monorepo setup with pnpm, I figure out that if you set |
@edmbn is also affected by this: #18227 (comment) |
I can confirm that this workaround just worked for me: #17687 (comment). Importing from node_modules and not using of the plugin works. |
Came across this problem myself |
@edmbn I had trouble getting that solution (via #17687 (comment) and https://github.com/adrianbienias/nextjs-prisma-monorepo-issue) working for myself, but it's because my repo has the package nested one level deeper. Getting the node modules path to the root node_modules folder and removing the @janpio given the above, i feel like this package should be deprecated and the warning message that prisma gives about the missing schema file should link to some blog post explaining this. |
Thanks for the highlight of the reproduction and that workaround, we will take a look at specifically this one to understand if there is something our |
Hello everyone 👋 Has anybody else faced the same issue? |
I have a turborepo, and have multiple prisma clients. Here is what worked out for me:
|
@stephenasuncionDEV the problem with this approach is that you then have a binary for each application in For deployments, you either eat the cost of unused binary bloat, or you have to do hacky |
Hey @stephenasuncionDEV and did you have to use nextjs-monorepo-workaround-plugin with it? |
Hi, I did not use any plugins. I just literally changed the output path. |
@filipechagas I am doing the same currently, and have this custom GH action clear up the package name: Clean Prisma Package
description: Cleans out Prisma files from other applications that are not needed in a deployed application.
inputs:
working-directory:
description: The working directory for the application.
required: true
runs:
using: composite
steps:
- name: Clean Prisma Package
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
# Delete output from other applications
set -x
pwd
ls ../../../node_modules/@prisma/client
app=$(echo "${{ inputs.working-directory }}" | cut -d'/' -f2)
for dir in ppc artelo ecominate; do
if [ "$dir" != "$app" ]; then
rm -rf "../../../node_modules/@prisma/client/$dir";
fi
done My different database packages in my repo are |
@stephenasuncionDEV I am doing this exact thing but am getting:
Would you mind elaborating on how you have your turborepo setup? Where do you have the I have two packages setup with an
|
Can confirm this fix worked for me. Apparently if you put your other clients under /client instead of beside it it works This didn't work for me
This worked
|
Bug description
@prisma/nextjs-monorepo-workaround-plugin
is not able to handle multiple generated clients in a monorepo setup, which are then most commonly bundled together via a Next.js app. The current logic poorly attempts to manage multiple schemas, and thus ends up updating the paths to only one schema across all the bundled clients. This obviously does not work and leads to various errors depending on how much the two schemas differ.#12853 (comment)
#12921 (comment)
#17687 (comment)
#17687 (comment)
How to reproduce
https://github.com/trentonsnyder/nextjs-prisma-repro (thanks @trentonsnyder)
Expected behavior
Multiple schemas can be handled without any issue when multiple clients are bundled.
Prisma information
n/a
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: