This error comes up due to the fact that you have a foreign key requirement on your DB.
So you need to check what you inserting into the DB and ensure that your insertion(s) meets up with the foreign key requirement.
This error comes up due to the fact that you have a foreign key requirement on your DB.
So you need to check what you inserting into the DB and ensure that your insertion(s) meets up with the foreign key requirement.
For further actions, you may consider blocking this person and/or reporting abuse
Rafael Camargo Leite -
Ritesh Hiremath -
Nozibul Islam -
Chijioke Osadebe -
Top comments (4)
This can also happen when using
upsert
, in our case we had aprisma
@relation
tied to a foreign key/FK
whoseOnUpdate
ReferentialAction
was not changed from the defaultNoAction
.The rather generic error message
Foreign key constraint failed on the field:
fk_ <..> (index)` doesn't help much on pinpointing the cause or any direction whatsoever.Changing the affected
@relation
'sOnUpdate
ReferentialAction
toCascade
enables theupdate
part of anupsert
to go through/work as expected.thank you for contributing
thank you very much I was searching for this!
I got the same issue, and spent hours fixing it thanks