Prisma TRPC Casing Issue

I have following schema:
model Customer {
id String @id @default(cuid())
userId String
companyId String? @unique
salutation String
firstname String
lastname String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
bankAccount BankAccount?
company Company[]
}
model Customer {
id String @id @default(cuid())
userId String
companyId String? @unique
salutation String
firstname String
lastname String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
bankAccount BankAccount?
company Company[]
}
I want to return the foreign key data aswell so I am doing this in my findMany
getAll: t.procedure.query(({ ctx }) => {
return ctx.prisma.customer.findMany({
include: {
company: true,
bankAccount: true
}
});
}),
getAll: t.procedure.query(({ ctx }) => {
return ctx.prisma.customer.findMany({
include: {
company: true,
bankAccount: true
}
});
}),
But I still get an error that my casing is wrong?
next-dev.js?a272:20 TRPCClientError:
Invalid `prisma.customer.findMany()` invocation:

{
include: {
company: true,
~~~~~~~
bankAccount: true,
~~~~~~~~~~~
? projects?: true,
? invoices?: true,
? files?: true,
? user?: true,
? BankAccount?: true,
? Company?: true,
? _count?: true
}
}
next-dev.js?a272:20 TRPCClientError:
Invalid `prisma.customer.findMany()` invocation:

{
include: {
company: true,
~~~~~~~
bankAccount: true,
~~~~~~~~~~~
? projects?: true,
? invoices?: true,
? files?: true,
? user?: true,
? BankAccount?: true,
? Company?: true,
? _count?: true
}
}
7 Replies
utdev
utdev3y ago
although I set it to lower case
Brendonovich
Brendonovich3y ago
Have you generated the client and migrations recently?
utdev
utdev3y ago
I ran npx prisma migrate dev nothing more
Brendonovich
Brendonovich3y ago
If running it again doesn't prompt you to create another migration then idk what's going on
utdev
utdev3y ago
it prompted another migration it created it but still same issue
Brendonovich
Brendonovich3y ago
To verify, it's a runtime issue and not a typescript issue?
utdev
utdev3y ago
I think it is a runtime issue, not a typescript issue Currently this is my query
getAll: t.procedure.query(({ ctx }) => {
return ctx.prisma.customer.findMany({
include: {
company: true,
bankAccount: true
}
});
}),
getAll: t.procedure.query(({ ctx }) => {
return ctx.prisma.customer.findMany({
include: {
company: true,
bankAccount: true
}
});
}),
no typescript errors but the error I described at the top, but if I change it to camel case like this:
getAll: t.procedure.query(({ ctx }) => {
return ctx.prisma.customer.findMany({
include: {
Company: true,
BankAccount: true
}
});
}),
getAll: t.procedure.query(({ ctx }) => {
return ctx.prisma.customer.findMany({
include: {
Company: true,
BankAccount: true
}
});
}),
I get a typescript issue but it works in my frontend wow this even happens after resetting all migrations and resetting my data
Want results from more Discord servers?
Add your server