I cannot solve this error. Any help?
Cannot select both '$scalars: true' and a specific scalar field 'accountCompanies'.
model Account {
id String @id @default(cuid())
avatar String?
lastName String
firstName String
accountCompanies AccountCompany[]
}
model Company {
id String @id @default(cuid())
name String
accountCompanies AccountCompany[]
}
model AccountCompany {
account Account @relation(fields: [accountId], references: [id], onDelete: Cascade)
accountId String
company Company @relation(fields: [companyId], references: [id], onDelete: Cascade)
companyId String
role Role @default(GENERAL)
@@id(fields: [accountId, companyId])
}
The above error occurs in the code below.
const account = await prisma.account.findUnique({
where: { auth0UserId: auth0User.sub },
include: { accountCompanies: true },
});
I had the same error, was able to clear it by restarting the TypeScript & Prism language servers in VSCode, and restarting the web server. That seems to be the recommended approach for resolving weird Prisma issues.
For anyone else searching this same error message, as this was basically the only page I found for it.
I had this issue due to a capitalization bug. I meant to be referencing a relationship using 'Products' with a capital 'P', but I had accidentally written 'products' with a lower case 'p' in both the 'create' and 'include' section of the Prisma query.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With