Next.js Discord

Discord Forum

Prisma "PrismaClientInitializationError" Error while deploying the monorepo/turbo repo on the vercel

Unanswered
Eyebrowed Thrush posted this in #help-forum
Open in Discord
Eyebrowed ThrushOP
I am deploying my nextJS project in the turbo repo to the Vercel i am having a Prisma error in the production although everything locally is working fine
-->Error
Unhandled Rejection: PrismaClientInitializationError: Prisma Client could not locate the Query Engine for runtime "rhel-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.

---> db.ts of web applicaiotn
import { PrismaClient } from "@repo/database"; const globalForPrisma = global as unknown as { db: PrismaClient }; export const db = globalForPrisma.db || new PrismaClient(); if (process.env.NODE_ENV !== "production") globalForPrisma.db = db;

generator client { provider = "prisma-client-js" // Disable its causing issues with the esm based project of nodejs // output = "../generated/prisma" }

8 Replies

You can try this:

generator client {
  provider = "prisma-client"
  output = "../generated/prisma" 
}


And then modify the import base on output location like:

import { PrismaClient } from "@/generated/prisma/client";
If you use prisma-client-js you need to define engine: classic, and then import prisma client from @prisma/client package.
Eyebrowed ThrushOP
prisma-client Is this the newer engine or js one @Shyam Verma
prisma-client
Eyebrowed ThrushOP
Sure sir i will give it a try
then will let you know
🙂
In the upcoming version, I think it will be default with no rust engine in prisma v7
Eyebrowed ThrushOP
Working Setup files
--> Next config.ts
import type { NextConfig } from "next"; import { PrismaPlugin } from "@prisma/nextjs-monorepo-workaround-plugin"; const nextConfig: NextConfig = { /* config options here */ webpack: (config, { isServer }) => { if (isServer) { config.plugins = [...config.plugins, new PrismaPlugin()]; } return config; }, }; export default nextConfig;

Prisma schema generator client { provider = "prisma-client-js" // Disable its causing issues with the esm based project of nodejs // output = "../generated/prisma" }


This solution to had worked for me from the prisma AI


Thanks sir @Shyam Verma
Hey @Eyebrowed Thrush don't tell me sir, I am just a 10th grade, 15th years old.