Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to filter remote schema with "where" #8901

Closed
munjalpatel opened this issue Sep 1, 2022 · 4 comments
Closed

Unable to filter remote schema with "where" #8901

munjalpatel opened this issue Sep 1, 2022 · 4 comments
Labels
k/bug Something isn't working

Comments

@munjalpatel
Copy link

Version Information

Server Version: 2.10.1

Environment

OSS

What is the current behaviour?

query get_team_ids($plan: String!) {
  billing {
    subscriptions(where: {product: {_eq: "aggregator"}, plan: {_eq: $plan}}) {
      customer {
        team_id
      }
    }
  }
}

When I execute the above query in Hasura Console UI (as an admin), it works just fine.
However, I get the following error when running it as a particular user role.

gql.transport.exceptions.TransportQueryError: {'extensions': {'code': 'validation-failed', 'path': '$.selectionSet.billing.selectionSet.subscriptions'}, 'message': "'subscriptions' has no argument named 'where'"}

Here are the remote schema permissions given to the role

permissions:
    - role: billing_subscription:read-any-for-aggregator
      definition:
        schema: "schema  { query: query_root }\n\nscalar timestamptz\n\nscalar uuid\n\ntype customers { created_at: timestamptz!\n  id: uuid!\n  stripe_id: String!\n  subscriptions: [subscriptions!]!\n  subscriptions_aggregate: subscriptions_aggregate!\n  team_id: uuid!\n  updated_at: timestamptz!\n}\n\ntype query_root { subscriptions(distinct_on: [subscriptions_select_column!], limit: Int, offset: Int, order_by: [subscriptions_order_by!], where: subscriptions_bool_exp @preset(value: {product: {_eq: \"aggregator\"}})): [subscriptions!]!\n  subscriptions_by_pk(id: uuid!): subscriptions\n}\n\ntype subscriptions { created_at: timestamptz!\n  customer: customers!\n  customer_id: uuid!\n  id: uuid!\n  plan: String!\n  product: String!\n  stripe_id: String!\n  updated_at: timestamptz!\n}\n\ntype subscriptions_aggregate { aggregate: subscriptions_aggregate_fields\n  nodes: [subscriptions!]!\n}\n\ntype subscriptions_aggregate_fields { count: Int!\n  max: subscriptions_max_fields\n  min: subscriptions_min_fields\n}\n\ntype subscriptions_max_fields { created_at: timestamptz\n  customer_id: uuid\n  id: uuid\n  plan: String\n  product: String\n  stripe_id: String\n  updated_at: timestamptz\n}\n\ntype subscriptions_min_fields { created_at: timestamptz\n  customer_id: uuid\n  id: uuid\n  plan: String\n  product: String\n  stripe_id: String\n  updated_at: timestamptz\n}\n\nenum order_by {asc \n  asc_nulls_first \n  asc_nulls_last \n  desc \n  desc_nulls_first \n  desc_nulls_last \n}\n\nenum subscriptions_select_column {created_at \n  customer_id \n  id \n  plan \n  product \n  stripe_id \n  updated_at \n}\n\ninput String_comparison_exp {_eq: String\n  _gt: String\n  _gte: String\n  _ilike: String\n  _in: [String!]\n  _iregex: String\n  _is_null: Boolean\n  _like: String\n  _lt: String\n  _lte: String\n  _neq: String\n  _nilike: String\n  _nin: [String!]\n  _niregex: String\n  _nlike: String\n  _nregex: String\n  _nsimilar: String\n  _regex: String\n  _similar: String\n}\n\ninput customers_bool_exp {_and: [customers_bool_exp!]\n  _not: customers_bool_exp\n  _or: [customers_bool_exp!]\n  created_at: timestamptz_comparison_exp\n  id: uuid_comparison_exp\n  stripe_id: String_comparison_exp\n  subscriptions: subscriptions_bool_exp\n  team_id: uuid_comparison_exp\n  updated_at: timestamptz_comparison_exp\n}\n\ninput customers_order_by {created_at: order_by\n  id: order_by\n  stripe_id: order_by\n  subscriptions_aggregate: subscriptions_aggregate_order_by\n  team_id: order_by\n  updated_at: order_by\n}\n\ninput subscriptions_aggregate_order_by {count: order_by\n  max: subscriptions_max_order_by\n  min: subscriptions_min_order_by\n}\n\ninput subscriptions_bool_exp {_and: [subscriptions_bool_exp!]\n  _not: subscriptions_bool_exp\n  _or: [subscriptions_bool_exp!]\n  created_at: timestamptz_comparison_exp\n  customer: customers_bool_exp\n  customer_id: uuid_comparison_exp\n  id: uuid_comparison_exp\n  plan: String_comparison_exp\n  product: String_comparison_exp\n  stripe_id: String_comparison_exp\n  updated_at: timestamptz_comparison_exp\n}\n\ninput subscriptions_max_order_by {created_at: order_by\n  customer_id: order_by\n  id: order_by\n  plan: order_by\n  product: order_by\n  stripe_id: order_by\n  updated_at: order_by\n}\n\ninput subscriptions_min_order_by {created_at: order_by\n  customer_id: order_by\n  id: order_by\n  plan: order_by\n  product: order_by\n  stripe_id: order_by\n  updated_at: order_by\n}\n\ninput subscriptions_order_by {created_at: order_by\n  customer: customers_order_by\n  customer_id: order_by\n  id: order_by\n  plan: order_by\n  product: order_by\n  stripe_id: order_by\n  updated_at: order_by\n}\n\ninput timestamptz_comparison_exp {_eq: timestamptz\n  _gt: timestamptz\n  _gte: timestamptz\n  _in: [timestamptz!]\n  _is_null: Boolean\n  _lt: timestamptz\n  _lte: timestamptz\n  _neq: timestamptz\n  _nin: [timestamptz!]\n}\n\ninput uuid_comparison_exp {_eq: uuid\n  _gt: uuid\n  _gte: uuid\n  _in: [uuid!]\n  _is_null: Boolean\n  _lt: uuid\n  _lte: uuid\n  _neq: uuid\n  _nin: [uuid!]\n}"

Even though, I am properly giving input subscriptions_bool_exp permission to the role.
Am I missing any other permission?

What is the expected behaviour?

The query should continue to work fine given permissions are correct.

@munjalpatel munjalpatel added the k/bug Something isn't working label Sep 1, 2022
@adas98012
Copy link
Contributor

adas98012 commented Sep 1, 2022

Thanks for bringing the issue to our attention. This issue looks similar to this reported earlier by another user of our community. You may track the issue till its resolution.

Meanwhile, there is a workaround for this, as suggested in the other ticket:
to edit the metadata manually to make the schema work

Please let us know if the info suffice.

@munjalpatel
Copy link
Author

Thanks @adas98012

That does sound similar. I'll wait for the bug to be fixed.
Is there an ETA? Can it be part of the next patch?

@adas98012
Copy link
Contributor

We don't have an ETA, but this in radar of the engineering team. We'll update the status of the issue accordingly. Thanks for your patience.

@dsandip dsandip closed this as completed Sep 3, 2022
@dsandip dsandip closed this as not planned Won't fix, can't repro, duplicate, stale Sep 3, 2022
@rahulagarwal13
Copy link
Contributor

@munjalpatel - we have fixed the issue in v2.13, can you please check and update?

hasura-bot pushed a commit that referenced this issue Apr 25, 2023
…e files (#8901)

GitOrigin-RevId: c97f36ffc68ac075354a0da8b2caf19ddc26e20c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
k/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants