Graphql-engine: Aggregates not found but queries are working fine

Created on 13 Oct 2019  路  1Comment  路  Source: hasura/graphql-engine

Following the apollo todos tutorial
Seem too be having an issue specific to queries

Simple query works:

const KPI = gql`
  query todos {
    todos {
      id
    }
  }`;

This simple aggregate:

const KPI = gql`
query todo_count {
  todos_aggregate {
    aggregate {
      count(columns: id)
    }
  }
}`;

Gives me an error:

Error: GraphQL error: field "todos_aggregate" not found in type: 'query_root'

Both the query and aggregate are working fine in the console.
But on the client only the query works.

Component for reference:

class Q extends Component {
  render() {
    return (
      <Query query={KPI}>
        {({ loading, error, data }) => {
          if (loading) {
            return <div>Loading. Please wait...</div>;
          }
          if (error) {
            console.log(error);
            return <div>Error loading users</div>;
          }
          return (
            <div>
              <h1>hi</h1>
              <pre>{JSON.stringify(data, null, 2)}</pre>
            </div>
          );
        }}
      </Query>
    );
  }
}

Tried changing permissions to allow all, but that didn't help
Any ideas? doesn't seem to be a common issue

Most helpful comment

Was a permissions issue - needed to allow aggregates for that table

>All comments

Was a permissions issue - needed to allow aggregates for that table

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stereobooster picture stereobooster  路  3Comments

EmrysMyrddin picture EmrysMyrddin  路  3Comments

egislook picture egislook  路  3Comments

bogdansoare picture bogdansoare  路  3Comments

shahidhk picture shahidhk  路  3Comments