Next.js Discord

Discord Forum

Next 14 and issues in production with Prisma in a monorepo on API routes

Unanswered
Bombay-duck posted this in #help-forum
Open in Discord
Avatar
Bombay-duckOP
I'm running into a strange issue with Next 14 in a mono repo and Prisma 4.16.2. I am using the @prisma/nextjs-monorepo-workaround-plugin experience no errors in dev and no errors in production when accessing my database from my page router pages via getStaticProps(). However, in production, my api routes trigger an error when they use the same Prisma database calls:
  ⨯ PrismaClientInitializationError: Your schema.prisma1 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
     at new ir (/Users/me/Downloads/edwt-new-test/frontend/.next/server/pages/api/wait-times.js:109:2373)
     at t.getEngine (/Users/me/Downloads/edwt-new-test/frontend/.next/server/pages/api/wait-times.js:180:5992)
     at new t (/Users/me/Downloads/edwt-new-test/frontend/.next/server/pages/api/wait-times.js:180:5576)
     at Object.getKeystone (/Users/me/Downloads/edwt-new-test/node_modules/@keystone-6/core/dist/createSystem-f4af134f.cjs.prod.js:2174:31)
     at getContext (/Users/me/Downloads/edwt-new-test/node_modules/@keystone-6/core/context/dist/keystone-6-core-context.cjs.prod.js:43:14)
     at /Users/me/Downloads/edwt-new-test/frontend/.next/server/pages/api/wait-times.js:4:22726
     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
   clientVersion: '4.16.2',
   errorCode: undefined
 }


Has anyone run into this or have a solution?

0 Replies