Has anyone been getting the error `duplicate key v...
# orm-help
b
Has anyone been getting the error
duplicate key value violates unique constraint
on upsert calls? Attempting to figure out a good repro case so I can create an issue but it seems sporadic and I can't quite tell how it is happening.
Code is simple so it is kinda confusing.
Copy code
const create: LogCreateInput = {
    id: logId,
    owner: { connect: { id: userId } },
    type: getLogType(date),
    date: normalizeDate(date),
  }

  return await db.log.upsert({
    where: { id: logId },
    create,
    update: create,
  })
r
Hey @BRob 👋 Are you passing the id manually on creation and update as well? Could you exclude the
id
field from
create
and
update
and then check if it works?