Prisma turborepo deployment not initialized error
Having issues with the Prisma initializations only on deployments using Turborepo. Anyone encountered the same issues? Works locally, the client is generated as included in part of the build process, but on deployments, I get an error as it's not initialized in the web app.
9 Replies
I have a package in /packages named database, which exports * from '@prisma/client'
I have setup the package.json right, I can work with the database package locally and while developing, I checked that the client is generated after removing node_modules, bun.lockb and simulate the build process.
send the errors and maybe someone can help
Bad Questions
An article by Josh
This is the error displayed in vercel logs.
This is the initialization in the apps/web
The error comes after trying to import prisma in a /pages folder in order to use it in getServerSideProps for doing a check. However, the blocker is the displayed error.
So @prisma/client
is only installed in @kleerk/database, and it has an index.ts which does
The basic example on turborepo prisma docs.
Then the initialization is done in the other packages which want to use PrismaClient.
At build time, it depends on a "db:generate" which generates the client and types for prisma
🤔
They displayed this as an example for how to setup turborepo with prisma
https://turbo.build/repo/docs/handbook/tools/prisma
.
yeah, that's how I defined the database package in my monorepo
Wow, for anybody else who can't read like me, the solution is in the error message.
Find out why and learn how to fix this: https://pris.ly/d/schema-not-found-nextjs
apparently it's a known issue and it's even a workaround plugin from prisma for monorepos.
Prisma
Using Prisma Client in a Next.js project in a monorepo setup
Using Prisma Client in a Next.js project in a monorepo setup