how do i prisma

given this model

model Vote {
  id          Int        @id @default(autoincrement())
  user        User       @relation(fields: [userId], references: [id])
  userId      String
  challenge   Challenge? @relation(fields: [challengeId], references: [id])
  challengeId Int?
  solution    Solution?  @relation(fields: [solutionId], references: [id])
  solutionId  Int?

  @@index([userId])
  @@index([challengeId])
  @@index([solutionId])
}


i am executing this create

    await prisma.vote.create({
      data: {
        challengeId,
        userId,
      }
    });

which results in this error
Argument `user` is missing.
- error Error:
Invalid `prisma.vote.create()` invocation:

{
  data: {
    challengeId: 3,
    userId: "bdc8a494-9d98-474d-bbe5-b069d934c49b",
+   user: {
+     create: UserCreateWithoutVoteInput | UserUncheckedCreateWithoutVoteInput,
+     connectOrCreate: UserCreateOrConnectWithoutVoteInput,
+     connect: UserWhereUniqueInput
+   }
  }
}


the userId and challengeId are both valid
seems like this should work?
Was this page helpful?