Ash FrameworkAF
Ash Framework8mo ago
18 replies
Failz

enabling multi tenant for graphql

turning on graphql for first time in my app (multi tenant)

# router.ex
  import AshAuthentication.Plug.Helpers

  pipeline :graphql do
    plug :load_from_bearer
    plug AshGraphql.Plug
  end

and my first query blows up with:

Queries against the App.Elevate.Group resource require a tenant to be specified

which makes sense. So reading ash graphl docs:

 AshGraphql.Plug

Automatically set up the GraphQL actor and tenant.

Adding this plug to your pipeline will automatically set the actor and tenant if they were previously put there by Ash.PlugHelpers.set_actor/2 or Ash.PlugHelpers.set_tenant/2.


Adding import Ash.PlugHelpers to bring in set_tenant and the IDE complains that
set_actor
is ambiguous. Does it matter which
set_actor
is used?
Was this page helpful?