Next.js Discord

Discord Forum

Prisma Vercel Error

Answered
Tan posted this in #help-forum
Open in Discord
TanOP
I am trying to deploy my project in vercel. I am using PrismaORM to interact with my db. I have also uploaded my db file in github. It is throwing wierd error. Locally it is running fine.

Type error: Property 'customer' does not exist on type 'PrismaClient<PrismaClientOptions, never, DefaultArgs>'. Did you mean 'customers'?
  4 | export const getAllCustomers = async () => {
  5 |   try {
> 6 |     const customers = await prisma.customer.findMany();
    |                                    ^
  7 |     return customers;
  8 |   } catch (e) {
  9 |     console.log(e);
Error: Command "npm run build" exited with 1

The error says property customer doesnt exist. I have migrated the schema and it is running fine locally I have also updated env variables but I am not aware where I went wrong.
Answered by Tan
okay I updated package.json
  "scripts": {
    "dev": "next dev",
    "build": "prisma generate && next build",
    "start": "next start",
    "lint": "next lint"
  },

I had to add prisma generate so that new schema would be generated. It was caused by vercel's build cache.
View full answer

3 Replies