PrismaP
Prisma13mo ago
11 replies
DaYroXy

"payload" argument must be of type object. Received null

hey guys im using nextjs and im facing the: "payload" argument must be of type object. Received null error
what is the reason im getting this error i cant find anything
    await prisma.patient.create({
        data: {
            firstName: "test",
            lastName: "test",
            phoneNumber: "0547194781",
            patientId: "123426789",
            firstVisit: new Date(),
            gender: "test",
            dateOfBirth: new Date(),
            address: {
                create: {
                    street: "test",
                    city: "test",
                    zipCode: "test",
                },
            },
        },
    });

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])
}
Was this page helpful?