diff --git a/content/200-orm/800-more/600-help-and-troubleshooting/100-help-articles/425-nextjs-prisma-client-monorepo.mdx b/content/200-orm/800-more/600-help-and-troubleshooting/100-help-articles/425-nextjs-prisma-client-monorepo.mdx index bc9802b4b7..a004be99c0 100644 --- a/content/200-orm/800-more/600-help-and-troubleshooting/100-help-articles/425-nextjs-prisma-client-monorepo.mdx +++ b/content/200-orm/800-more/600-help-and-troubleshooting/100-help-articles/425-nextjs-prisma-client-monorepo.mdx @@ -6,17 +6,32 @@ metaDescription: 'Using Prisma Client in a Next.js project in a monorepo setup' ## Problem -If you use Prisma Client in a [Next.js](https://nextjs.org/) application within a monorepo, you will likely run into an error such as the following: +If you use Prisma Client in a [Next.js](https://nextjs.org/) application within a monorepo, you may run into an error that looks similar to: -``` -Error: Your schema.prisma could not be found, and we detected that you are using Next.js. -Find out why and learn how to fix this: https://pris.ly/d/schema-not-found-nextjs -``` +```terminal no-copy wrap +Prisma Client could not locate the Query Engine for runtime "debian-openssl-3.0.x". -If you are using a Prisma version earlier than 4.11.0, the error message you will receive will look similar to the message below: +We detected that you are using Next.js, learn how to fix this: https://pris.ly/d/engine-not-found-nextjs. +This is likely caused by tooling that has not copied "libquery_engine-debian-openssl-3.0.x.so.node" to the deployment folder. +Ensure that you ran \`prisma generate\` and that "libquery_engine-debian-openssl-3.0.x.so.node" has been copied to "generated/client". + +We would appreciate if you could take the time to share some information with us. +Please help us by answering a few questions: https://pris.ly/engine-not-found-tooling-investigation ``` -Error: ENOENT: no such file or directory, open '/prisma-next-mono-reproduction/packages/service/.next/cache/webpack/client-development/schema.prisma' + +or: + +```terminal no-copy wrap +Prisma Client could not locate the Query Engine for runtime "debian-openssl-3.0.x". + +We detected that you are using Next.js, learn how to fix this: https://pris.ly/d/engine-not-found-nextjs. + +This is likely caused by a bundler that has not copied "libquery_engine-debian-openssl-3.0.x.so.node" next to the resulting bundle. +Ensure that "libquery_engine-debian-openssl-3.0.x.so.node" has been copied next to the bundle or in "generated/client". + +We would appreciate if you could take the time to share some information with us. +Please help us by answering a few questions: https://pris.ly/engine-not-found-bundler-investigation ``` Assume you have a monorepo with the following structure: @@ -50,7 +65,7 @@ The file tree above shows a monorepo contained in a `packages` folder. Inside, t - `db`: Contains the generated Prisma Client in a custom output location named `client`. `index.ts` at the root of this package exports the instantiated Prisma Client. - `service`: Contains a Next.js application. The `test.js` API route uses the Prisma Client instance provided by the `db` package. -The error mentioned above occurs as a result of a bundling problem during Next.js's bundling process. The `schema.prisma` and Query Engine files are expected to be found next to the generated Prisma Client. The bundling process, however, does not copy over those files to the output location of the bundle. +The errors mentioned above occur as a result of a bundling problem during Next.js's bundling process. The Query Engine file(s) is expected to be found next to the generated Prisma Client. The bundling process, however, does not copy over those files to the output location of the bundle.