JudgeJLo
JudgeJLo
Explore posts from servers
PPrisma
Created by JudgeJLo on 7/22/2024 in #help-and-questions
unrecognized keys some
No description
4 replies
PPrisma
Created by JudgeJLo on 5/1/2024 in #help-and-questions
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" } });
}),
3 replies
TTCTheo's Typesafe Cult
Created by JudgeJLo on 4/16/2024 in #questions
Issues with Clerk and Unit testing
I am working on a project for work and we have a strict requirement for unit tests. I decided to go with Vitest and we're using Clerk for auth. I ran into two different issues and I'm not sure which path is easier to solve. When I run the test (one so far) using the render method from @testing-library/react I get an error that "AuthContext not found". That made sense so I used a pattern I've used elsewhere of making a wrapper for render that wraps all children in a ClerkProvider. When I do that I get a new error that says ClerkProvider.js 2 seems to be an ES Module but shipped in a CommonJS package. You might want to create an issue to the package "@clerk/nextjs" asking them to ship the file in .mjs extension or add "type": "module" in their package.json. I'm unsure how to proceed as the only issue I currently have with Clerk is that they have zero guidance on how to set up any tests within the auth context. Hoping someone has encountered this and has a pointer towards a solve.
3 replies
TTCTheo's Typesafe Cult
Created by JudgeJLo on 2/12/2024 in #questions
Inferring types from Prisma schema for Zod input
I can’t find this in any of the docs, but I feel like there has to be a way. Instead of redefining each property on an input I want to define it as a type I’m already using elsewhere that was generated by Prisma. Infer uses an actual value to do this, not a type. Is there a way to do this using the type?
2 replies
TTCTheo's Typesafe Cult
Created by JudgeJLo on 6/18/2023 in #questions
SKIP_ENV_VALIDATION
I have this set to 'true' in my .env but I'm still getting errors about missing envs (they aren't missing and have another question open about why) but my understanding would be that this should skip such a check and therefore should make seeing that error impossible.
5 replies
TTCTheo's Typesafe Cult
Created by JudgeJLo on 6/18/2023 in #questions
Invalid Environment Variables
16 replies
TTCTheo's Typesafe Cult
Created by JudgeJLo on 2/11/2023 in #questions
Typing Props
6 replies