-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
I'm doing an insert mutation that fails when run with a particular limited role:
{
"errors": [
{
"extensions": {
"path": "$.selectionSet.insert_xs_y_one.args.object.x.data.user_id",
"code": "validation-failed"
},
"message": "field \"user_id\" not found in type: 'xs_insert_input'"
}
]
}
with a particular role.
I've verified the permissions -- the role is allowed to set the user_id value and the token contains the correct and expected claims.
The mutation should insert into two tables: the mutation object writes to the child table, and this table has an object relationship to a parent table, where the foreign key does include the user_id column. I have tried setting the user_id value on each of the child and parent objects, as well as both, and all of these cases error.
The problem appears to be a "Column Preset" -- the column preset in this case is set to X-Hasura-User-Id which is the same value for user_id that is being passed in the mutation. If the column preset is removed, then the mutation works (but of course no longer works if the user_id is not specified in the mutation). If the column preset is left, then the mutation only works if no user_id is specified in the mutation.
I don't believe this should be the case -- the column preset should default a missing value, not prevent a mutation that contains the value from working (and furthermore, the value passes all the permission checks and matches the preset).
Failing configuration:
Working configuration, same as above, without user_id column preset.
Hasura v2.13.2
