P
Prisma3mo ago
JudgeJLo

invalid invocation prisma.paypal.findMany()

I'm quite confused by this error since it only happens at runtime when deployed. Cannot recreate locally. We have a findMany query that is throwing this error: Error converting field "date" of expected non-nullable type "String", found incompatible value of "2024-04-28 00:00:00 +00:00" This is the model:
model Paypal {
id Int @id @default(autoincrement()) @db.UnsignedInt
faId String @default("") @db.VarChar(255)
faFirstName String @default("") @db.VarChar(255)
faLastName String @default("") @db.VarChar(255)
amount String @default("") @db.VarChar(255)
reason String @default("") @db.VarChar(255)
status String @default("") @db.VarChar(255)
payoutBatchId String @default("") @db.VarChar(255)
batchStatus String @default("") @db.VarChar(255)
completedBy String @default("") @db.VarChar(255)
email String @default("") @db.VarChar(255)
payoutItemId String @default("") @db.VarChar(255)
transactionStatus String @default("") @db.VarChar(255)
userId Int? @db.UnsignedInt
reasonNotes String @default("") @db.VarChar(255)
date DateTime? @db.Date
completionDate DateTime? @db.Date
users Users? @relation(fields: [userId], references: [id], onDelete: Restrict, map: "paypal_ibfk_1")

@@index([userId], map: "userId")
@@map("paypal")
}
model Paypal {
id Int @id @default(autoincrement()) @db.UnsignedInt
faId String @default("") @db.VarChar(255)
faFirstName String @default("") @db.VarChar(255)
faLastName String @default("") @db.VarChar(255)
amount String @default("") @db.VarChar(255)
reason String @default("") @db.VarChar(255)
status String @default("") @db.VarChar(255)
payoutBatchId String @default("") @db.VarChar(255)
batchStatus String @default("") @db.VarChar(255)
completedBy String @default("") @db.VarChar(255)
email String @default("") @db.VarChar(255)
payoutItemId String @default("") @db.VarChar(255)
transactionStatus String @default("") @db.VarChar(255)
userId Int? @db.UnsignedInt
reasonNotes String @default("") @db.VarChar(255)
date DateTime? @db.Date
completionDate DateTime? @db.Date
users Users? @relation(fields: [userId], references: [id], onDelete: Restrict, map: "paypal_ibfk_1")

@@index([userId], map: "userId")
@@map("paypal")
}
This query just returns all records and sorts so newest is first. I've tested with and without the orderBy directive and the result is the same. Here is the query: javascript
getAll: publicProcedure.query(async ({ ctx }) => {
return await ctx.db.paypal.findMany({ take: 100, orderBy: { date: "desc" } });
}),
getAll: publicProcedure.query(async ({ ctx }) => {
return await ctx.db.paypal.findMany({ take: 100, orderBy: { date: "desc" } });
}),
0 Replies
No replies yetBe the first to reply to this messageJoin