I'm trying to deploy to Vercel but my deployment crashed due to the following problem:
PrismaClientInitializationError: Prisma has detected that this project was built on Vercel, which caches dependencies. This leads to an outdated Prisma Client because Prisma's auto-generation isn't triggered. To fix this, make sure to run the `prisma generate` command during the build process.
Learn how: https://pris.ly/d/vercel-build
at eu (/vercel/path0/node_modules/@prisma/client/runtime/library.js:164:69)
at new t (/vercel/path0/node_modules/@prisma/client/runtime/library.js:177:3203)
at 40754 (/vercel/path0/.next/server/chunks/578.js:138:37)
at __webpack_require__ (/vercel/path0/.next/server/webpack-runtime.js:25:43)
at 76578 (/vercel/path0/.next/server/chunks/578.js:23:16)
at __webpack_require__ (/vercel/path0/.next/server/webpack-runtime.js:25:43)
at 32631 (/vercel/path0/.next/server/app/(site)/home/page.js:4370:22)
at Function.__webpack_require__ (/vercel/path0/.next/server/webpack-runtime.js:25:43)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async collectGenerateParams (/vercel/path0/node_modules/next/dist/build/utils.js:822:17) {
clientVersion: '4.15.0',
errorCode: undefined
}
> Build error occurred
Error: Failed to collect page data for /home
at /vercel/path0/node_modules/next/dist/build/utils.js:1155:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
type: 'Error'
}
Error: Command "npm run build" exited with 1
BUILD_UTILS_SPAWN_1: Command "npm run build" exited with 1
I created a global PrismaClient as recommended in the docs in my app/lib dir:
import { PrismaClient } from "@prisma/client";
declare global {
var prisma: PrismaClient | undefined;
}
const client = globalThis.prisma || new PrismaClient();
if (process.env.NODE_ENV !== "production") globalThis.prisma = client;
export default client;
So I'm not sure what the issue is