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
Was a permissions issue - needed to allow aggregates for that table
Most helpful comment
Was a permissions issue - needed to allow aggregates for that table