Invited_by_id` in `insert` does not match type :id (PowInvitation)

I suspect that you are trying to save a string as an uuid. You should try using Ecto.UUID.dump!/1 to cast that value to a binary first. I had the same problem some time ago.

If that’s not the case (if you are using a changeset to cast the values for example), check if you field is actually an uuid/ binary_id as you seem to be trying to persist one.

PS.: Also, if possible, replace the screenshots with markup so the forum search can properly index it. This will make your post more accessible to other people searching for a similar solution.

Update: Seems that your user schema is setting @primary_key as uuid but you are not specifying a @foreign_key_type even though you are referencing the users table by the invited_by_id fk. Could you also check that please?

2 Likes