hasura / hasura/graphql-engine

Unable to set Permissions for non-admin Roles on Remote Schema queries/mutations with default values

Open
#9,504 0 comments 2 reactions 0 assignees View on GitHub
k/bug
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: v2.13.0
CLI Version (for CLI related issue):

### Environment

Cloud (Running on GCP Cloud Run)

### What is the current behaviour?

The Hasura instance is linked to an external GraphQL server (`extender`, written in Python with `strawberry` library) using the Remote Schema feature. Some queries/mutations in the external GraphQL have default values, including `None`/`null`. Using these queries and mutations through Hasura works flawlessly with the default values set correctly. However, trying to set up permissions raises the following error:
```
validation for the given role-based schema failed because the expected default value of input value: "range" of input object "set_spacers_range" to be 25 but received
```

### What is the expected behavior?

This error should not appear as default values technically have nothing to do with permissions. Furthermore, Hasura should be able to not set optional values on its own.

### How to reproduce the issue?

1. Create an external GraphQL service with a query/mutation that has at least one default value (preferably in Python).
2. Link the external GraphQL service with Hasura as a remote schema
3. Attempt to give permission(s) for non-admin role on that query/mutation

### Please provide any traces or logs that could help here.
A snippet of the GraphQl mutation that is causing the error:

```graphql
type Mutation {
set_spacers_range(sp_id: String!, range: Int = 25): Spacer
}
```

The error, as returned by Hasura

```
validation for the given role-based schema failed because the expected default value of input value: "range" of input object "set_spacers_range" to be 25 but received
```

### Keywords
remote-schema, permissions, default-values

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.