S
Supabase•2mo ago
Sebz

GraphQL Aggregate

Hey guys ! I've been struggling enabling graphql aggregate on my supabase cloud instance. I've followed: https://supabase.com/docs/guides/graphql/configuration#aggregate But still no aggregate field appears in my GraphiQL interface, even after refresh. Any ideas ? Anyone had success with this ?
Configuration & Customization | Supabase Docs
Extra configuration options can be set on SQL entities using comment directives.
9 Replies
Lordvickthor
Lordvickthor•2mo ago
Hey! I’ve helped others enable GraphQL aggregate on Supabase cloud before. Often the issue comes down to missing RLS permissions or the schema not being exposed correctly. I can guide you step by step to get the aggregate fields showing in GraphiQL. are you using Row Level Security (RLS) on that table, and have you confirmed the role has select privileges? @Sebz
Sebz
SebzOP•2mo ago
Hey thanks for replying Ok let me give you more details So I have TableA which I need aggregates on. TableA has a 1-1 relationship with TableB (TableB is some kind of group table, users belong to a group and the group can access certain records) User also has a 1-1 relationship with TableB The select RLS I have on TableA is basically user is authenticated AND user belongs to the right Group However I'm not sure RLS are the issue here as I can't even see the aggregate field in the GraphiQL interface in the dashboard, I exposed the schema using:
comment on table public.tableA is e'@graphql({"aggregate": {"enabled": true}})';
comment on table public.tableA is e'@graphql({"aggregate": {"enabled": true}})';
But on the GraphiQL I only see:
query tableACollection(...) {
edges: [meetingsEdge!]!
pageInfo: PageInfo!
}
query tableACollection(...) {
edges: [meetingsEdge!]!
pageInfo: PageInfo!
}
While from my understanding, I should also see the aggregate field
garyaustin
garyaustin•2mo ago
@Sebz So I'm a bit puzzled on aggregates looking at the repository... This is a PR that seems to implement them (and mentions updating docs from May 7th.... https://github.com/supabase/pg_graphql/pull/589 BUT the current release is 1.5.11 from FEB! https://github.com/supabase/pg_graphql/releases You might ask in that repository as something seems fishy. But I also don't use it so not 100% everything is in the extension... but I would think so. There are not many GraphQL users here.
Sebz
SebzOP•2mo ago
Oh wow that's indeed a great catch, sorry I missed that ^^ I'm wondering why are people not using graphql ? anything I'm missing, I find it really convenient to query nested relationships.. maybe its only me
garyaustin
garyaustin•2mo ago
@Lordvickthor 👑 You say you have helped users implement aggregates. Can you confirm they are working? I'm skeptical. You can search on GraphQL here to get a feel of users. I just don't see many asking for help. I can't comment on what that means as far as overall use. Also its not good they added docs if not released even after 3 months. But I could be missing something. Generate an issue there.
Sebz
SebzOP•2mo ago
I'll do that thanks for your reply !
Sebz
SebzOP•2mo ago
Update: they will do a release soon https://github.com/supabase/pg_graphql/issues/602
GitHub
Documentation lists Aggregate, but feature not released in pg_graph...
Describe the bug The Supabase GraphQL documentation mentions the possibility to enable aggregate fields using table comments (see: https://supabase.com/docs/guides/graphql/configuration#aggregate)....
garyaustin
garyaustin•2mo ago
Thanks for checking. I'm not sure what @Lordvickthor 👑 was referring to that they helped several people enable it....
Dereck
Dereck•3w ago
this helped me so much. i spent like three hours trying to figure it out.

Did you find this page helpful?