unhandledRejection: [TypeError: The "payload" argument must be of type object. Received null]
Unanswered
Cornish Rex posted this in #help-forum
Cornish RexOP
[TypeError: The "payload" argument must be of type object. Received null] {
code: 'ERR_INVALID_ARG_TYPE'
}
⨯ unhandledRejection: [TypeError: The "payload" argument must be of type object. Received null] {
code: 'ERR_INVALID_ARG_TYPE'
}
⨯ unhandledRejection: [TypeError: The "payload" argument must be of type object. Received null] {
code: 'ERR_INVALID_ARG_TYPE'
}
hey guys im using prisma and i cannot create data as i keep getting unhandled rejection can i get any help please?
await prisma.patient.create({
data: {
patientId: "123456789",
firstName: "test",
lastName: "test",
fullName: "test",
dateOfBirth: new Date(),
gender: "male",
phoneNumber: "0547894561",
workPhoneNumber: "",
homePhoneNumber: "",
additionalPhoneNumber: "",
firstVisit: new Date(),
email: "testing@gmail.com",
},
});
schemas:
model Patient {
id Int @id @default(autoincrement())
patientId String @unique @db.VarChar(10)
firstName String
lastName String
fullName String?
dateOfBirth DateTime
gender String
phoneNumber String
workPhoneNumber String?
homePhoneNumber String?
additionalPhoneNumber String?
firstVisit DateTime
email String? @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
address Patient_Address?
}
model Patient_Address {
id Int @id @default(autoincrement())
street String?
city String
zipCode String?
patientId Int @unique
patient Patient @relation(fields: [patientId], references: [id])
}
5 Replies
@Yi Lon Ma Yea this errr doesn't tell anything. Wrap the .create call in try catch and log the error in that
Cornish RexOP
it is in a try catch and this is the error that being logged
sorry, I don't have much info about this
White-eared Hummingbird
I got same the issue, even try to get simple data like
findFirst
Gharial
Its query error. You can enable DEBUG="prisma*" in env to see exact sql error