I have a NextJS app (TypeScript) using Prisma on Netlify. Recently, I introduced a new model named Trade in the Prisma schema file:
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Contract {
id Int @id @default(autoincrement())
contractAddress String @unique
baseUri String
tokenName String @default("")
verified Boolean @default(false)
}
model Trade {
id Int @id @default(autoincrement())
tradeId Int @unique
status Int
}
I created the migration file and executed the migrations locally and in production successfully, confirming the existence of the new table in both databases.
Although everything works well locally, attempting to deploy to Netlify results in an error shown in the build log:
Type error: Property 'trade' does not exist on type 'PrismaClient<PrismaClientOptions, never, RejectOnNotFound | RejectPerOperation | undefined>'.
12:37:51 PM: 10 | return res.status(400).send({ message: "No trade ID provided" })
12:37:51 PM: 11 | try {
12:37:51 PM: > 12 | const tradeInDatabase = await prisma.trade.findFirst({
The Prisma plugin is integrated into the site, and everything was functioning smoothly with other models until the addition of this new model. Trying to resolve why the Prisma client lacks awareness of the new model in a production environment.
Any assistance would be greatly appreciated!