Idempotent Insert / Upsert _PLACEHOLDER Error #9767
-
ContextHasura v2.29.0 recently released a new beta feature, Input Validation, which can allow a webhook to verify data payloads before they get inserted into the database. The following bug only occurs when using an x-hasura-role that has been configured for remote Input Validation; when I'm just using the admin secret key, the request succeeds. Minimal Reproductionhttps://github.com/kevinmichaelchen/hasura-9767 DescriptionIn my example, I have two Postgres tables: Both have There's a nullable When I perform a bulk insert using onConflict (basically an upsert), I get an error related to The Mutationmutation CreatePetAndOwner(
$owner: OwnerInsertInput!
$pet: PetInsertInput!
) {
owner: insertOwnerOne(
object: $owner
onConflict: {
constraint: owner_pkey
updateColumns: [id]
}
) {
id
}
pet: insertPetOne(
object: $pet
onConflict: {
constraint: pet_pkey
updateColumns: [id]
}
) {
id
}
} Variables{
"owner": {
"id": "6b683c4d-0fb0-4f47-b3f4-822177753b1d",
"name": "Kevin"
},
"pet": {
"id": "5cd3dc17-1b05-433c-b8a4-9c2f4a09c603",
"name": "Sparky",
"ownerId": "6b683c4d-0fb0-4f47-b3f4-822177753b1d"
}
} Error Response{
"errors": [
{
"message": "expected one of the values ['_PLACEHOLDER'] for type 'OwnerUpdateColumn', but found 'id'",
"extensions": {
"path": "$.selectionSet.insertOwnerOne.args.onConflict.updateColumns[0]",
"code": "validation-failed"
}
}
]
} Getting it workingWhen I uncheck the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It was a Permissions issue all along. I was just missing update permissions on those tables, so the upsert was failing. Per the docs:
Fixed in this PR. Thanks to @dventimihasura for spotting the fix. |
Beta Was this translation helpful? Give feedback.
It was a Permissions issue all along.
I was just missing update permissions on those tables, so the upsert was failing. Per the docs:
Fixed in this PR.
Thanks to @dventimihasura for spotting the fix.