Currently, I am working on a nextjs project hosted on Vercel, utilizing TypeScript and Prisma. Here are the versions I am using:
- "next": "13.0.3"
- "typescript": "4.9.3"
- "prisma": "^4.6.1"
My local build is successful, but I am encountering a failure on Vercel:
Type error: Property 'companies' does not exist on type 'PrismaClient<PrismaClientOptions, never, RejectOnNotFound \| RejectPerOperation \| undefined>'.
--
01:05:17.287 |
01:05:17.287 | 71 \| },
01:05:17.288 | 72 \| companies: async () => {
01:05:17.288 | > 73 \| const companies = await prisma.companies.findMany();
01:05:17.289 | \| ^
01:05:17.289 | 74 \| return companies;
01:05:17.289 | 75 \| },
01:05:17.289 | 76 \| },
Oddly, TypeScript is not recognizing 'companies' as a property of Prisma. I've attempted to resolve this by regenerating the Prisma Client, removing the model and executing commands like prisma format, prisma generate, prisma db push. It's worth mentioning that I'm using MongoDB for this project.
Here is a snippet from './prisma/schema.prisma':
model companies {
id String @id @default(auto()) @map("_id") @db.ObjectId
v Int? @map("__v")
name String
}
Interestingly, production builds were smooth sailing until the addition of this new model.