-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prisma Client: Unknown Argument #24622
Comments
Hello @cadinhoruf, I couldn't reproduce this issue. generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlserver"
url = env("DATABASE_URL")
}
model QSMS06 {
id Int @id @default(autoincrement())
usuarioId Int
dtVerificacao DateTime @db.DateTime
filialId Int
projetoId Int
nmEnvolvido String @db.NVarChar(150)
departamentoId Int
qsmsCatRiscoId Int
desvio String @db.NVarChar(150)
acaoTomada String @db.NVarChar(255)
resolvido Boolean
justificativa String @db.NVarChar(255)
dtPrazoAdequacao DateTime @db.DateTime
foto Bytes?
dtCriacao DateTime? @default(now()) @db.DateTime
dtAtualizacao DateTime? @db.DateTime
stAcao String?
dtAdequacao DateTime? @db.DateTime
observacao String?
QSMS06L QSMS06L[]
}
model QSMS06L {
id Int @id @default(autoincrement())
aQsmsDesviosId Int?
usuarioId Int?
dtVerificacao DateTime? @db.DateTime
filialId Int?
projetoId Int?
nmEnvolvido String? @db.NVarChar(150)
departamentoId Int?
qsmsCatRiscoId Int?
desvio String? @db.NVarChar(150)
acaoTomada String? @db.NVarChar(255)
resolvido Boolean?
justificativa String? @db.NVarChar(255)
dtPrazoAdequacao DateTime?
dtCriacao DateTime? @db.DateTime
dtAtualizacao DateTime? @default(now()) @db.DateTime
stAcao String?
acao String?
dtAdequacao DateTime?
observacao String?
QSMS06 QSMS06? @relation(fields: [qSMS06Id], references: [id])
qSMS06Id Int?
} import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
async function main() {
const isoDate = new Date().toISOString();
await prisma.qSMS06L.create({
data: {
usuarioId: 4,
observacao: 'adequado',
aQsmsDesviosId: 22,
acao: 'U',
dtAdequacao: isoDate,
},
});
}
main() Can you please double-check that you re-ran |
Hey jkomyno, this problem happens sometimes, when I open this problem, it was happening, but now it is no longer. The problem is basically when there is a foreign key, sometimes in the log tables it does not recognize the id, even though it exists, and the relationship between the tables also exists. This is the table of users : model USER00 {
id Int @id @unique @default(autoincrement())
nome String @db.NVarChar(100)
email String @unique @db.NVarChar(60)
st Boolean
dtCriacao DateTime? @default(now(), map: "DF__tmp_ms_xx__dtCri__2097C3F2") @db.DateTime
dtAtualizacao DateTime? @db.DateTime
aprovador Boolean?
senha String? @db.NVarChar(100)
admin Boolean?
departamentoId Int?
usuarioId Int?
CKLT00 CKLT00[]
CKLT00L CKLT00L[]
CKLT01 CKLT01[]
CKLT01L CKLT01L[]
CKLT02 CKLT02[]
CKLT02L CKLT02L[]
CKLT03 CKLT03[]
CKLT03L CKLT03L[]
CKLT04 CKLT04[]
CKLT04L CKLT04L[]
CKLT05 CKLT05[]
CKLT05L CKLT05L[]
CKLT06 CKLT06[]
CKLT06L CKLT06L[]
CKLT07 CKLT07[]
CKLT07L CKLT07L[]
CKLT08 CKLT08[]
CKLT08L CKLT08L[]
CKLT09 CKLT09[]
CKLT09L CKLT09L[]
CKLT10 CKLT10[]
CKLT10L CKLT10L[]
CKLT11 CKLT11[]
CKLT11L CKLT11L[]
DCMT00 DCMT00[]
DCMT00L DCMT00L[]
DCMT01 DCMT01[]
DCMT01L DCMT01L[]
DCMT02 DCMT02[]
DCMT02L DCMT02L[]
DCMT03 DCMT03[]
DCMT03L DCMT03L[]
DCMT04 DCMT04[]
DCMT04L DCMT04L[]
DCMT05 DCMT05[]
DCMT05L DCMT05L[]
DCMT06 DCMT06[]
DCMT06L DCMT06L[]
EMPR00 EMPR00[]
EMPR00L EMPR00L[]
EMPR01 EMPR01[]
EMPR01L EMPR01L[]
EMPR02 EMPR02[]
EMPR02L EMPR02L[]
EMPR03 EMPR03[]
EMPR03L EMPR03L[]
EQPM00 EQPM00[]
EQPM00L EQPM00L[]
EQPM01 EQPM01[]
EQPM01L EQPM01L[]
EQPM02 EQPM02[]
EQPM02L EQPM02L[]
EQPM03 EQPM03[]
EQPM03L EQPM03L[]
EQPM04 EQPM04[]
EQPM04L EQPM04L[]
EQPM05 EQPM05[]
EQPM05L EQPM05L[]
EQPM06 EQPM06[]
EQPM06L EQPM06L[]
EQPM07 EQPM07[]
EQPM07L EQPM07L[]
EQPM08 EQPM08[]
EQPM08L EQPM08L[]
EQPM09 EQPM09[]
EQPM09L EQPM09L[]
EQPM10 EQPM10[]
EQPM10L EQPM10L[]
FUNC00 FUNC00[]
FUNC00L FUNC00L[]
FUNC01L FUNC01L[]
FUNC02 FUNC02[]
FUNC02L FUNC02L[]
FUNC03 FUNC03[]
FUNC03L FUNC03L[]
GEOG00 GEOG00[]
GEOG00L GEOG00L[]
GEOG01 GEOG01[]
GEOG01L GEOG01L[]
GEOG02 GEOG02[]
GEOG02L GEOG02L[]
GEOG03 GEOG03[]
GEOG03L GEOG03L[]
GEOG04 GEOG04[]
GEOG04L GEOG04L[]
GEOG05 GEOG05[]
GEOG05L GEOG05L[]
operador HELP00[] @relation("Operador")
solicitante HELP00[] @relation("Solicitante")
HELP00L HELP00L[]
HELP01 HELP01[]
HELP01L HELP01L[]
HELP02 HELP02[]
HELP02L HELP02L[]
HELP03 HELP03[]
HELP03L HELP03L[]
HELP04 HELP04[]
HELP04L HELP04L[]
HELP05 HELP05[]
HELP05L HELP05L[]
HELP06 HELP06[]
HELP06L HELP06L[]
HELP07 HELP07[]
HELP07L HELP07L[]
ITEM01 ITEM01[]
ITEM01L ITEM01L[]
QSMS00 QSMS00[]
QSMS01 QSMS01[]
QSMS01L QSMS01L[]
QSMS02 QSMS02[]
QSMS02L QSMS02L[]
QSMS03 QSMS03[]
QSMS03L QSMS03L[]
QSMS04 QSMS04[]
QSMS04L QSMS04L[]
QSMS06 QSMS06[]
QSMS06L QSMS06L[]
QSMS07 QSMS07[]
QSMS07L QSMS07L[]
QSMS08 QSMS08[]
QSMS08L QSMS08L[]
QSMS09L QSMS09L[]
QSMS10 QSMS10[]
QSMS10L QSMS10L[]
QSMS13 QSMS13[]
QSMS13L QSMS13L[]
QSMS14 QSMS14[]
QSMS14L QSMS14L[]
FUNC01 FUNC01? @relation(fields: [departamentoId], references: [id])
USER00L USER00L[]
USER01 USER01[]
USER01L USER01L[]
USER02 USER02[]
USER02L USER02L[]
USER03 USER03[]
USER03L USER03L[]
QSMS15 QSMS15[]
QSMS15L QSMS15L[]
QSMS16 QSMS16[]
QSMS16L QSMS16L[]
QSMS17 QSMS17[]
QSMS17L QSMS17L[]
@@index([email])
} Thx for the support |
Hey @cadinhoruf, can you please provide a self-contained reproduction of this problem? Providing just a few models at a time unfortunately doesn't help, as we see you have tens of relations, each of which may have a foreign key constraint. If you manage to provide a small repro, that'd be great, as it'd allow us to pinpoint the issue quickly and hopefully provide a fix in a timely manner. Thanks! |
The problem didn't happen again. |
I am still experiencing this bug. UPDATE: I figured out what the problem was. The error message was incorrect. My schema looks something like this:
When I passed in an object to the
Even though |
Bug description
When attempting to create a record in the logTables model using Prisma Client, I encounter the following error: "Unknown argument usuarioId. Available options are marked with ?". The usuarioId field is defined in the Prisma schema, and querying the database with this field works.
How to reproduce
I Call the api route and this error returns for me.
Expected behavior
Based in the schemas, i need to not return the error, because the fields exist in both tables.
Prisma information
TS
Environment & setup
Prisma Version
prisma : 5.15.1
@prisma/client : 5.15.1
Error
The text was updated successfully, but these errors were encountered: