Intended usage of Absinthe.Plug.GraphiQL vs Absinthe.Plug

Hi all!

What is the correct way to think about Absinthe.Plug.GraphiQL and its relationship to Absinthe.Plug?
I’m building an API that is entirely GraphQL, so I’m eschewing the Phoenix router and using the Absinthe plugs directly. I initially thought that the former would be used in addition to the latter to provide the GraphiQL interface, but I’m getting (Plug.Conn.AlreadySentError) the response was already sent errors when both plugs were added to my endpoint. It looks like Absinthe.Plug.GraphiQL encapsulates Absinthe.Plug, and using the former means I don’t need the latter. Is that correct? The docs aren’t particularly clear about this …

I’ve ended up with this setup, which seems to be working, but it would be good to confirm that I’m on the right track:

defmodule App.Endpoint do
  use Phoenix.Endpoint, otp_app: :app
  # etc
  if Mix.env() == :dev do
    plug Absinthe.Plug.GraphiQL,
      schema: WriterWeb.Schema,
      json_codec: Jason,
      interface: :playground
    plug Absinthe.Plug,
      schema: WriterWeb.Schema,
      json_codec: Jason


Yes you are in the right track, the Absinthe.Plug.GraphiQL provides a mapping and serving for graphiql explorer, while Absinthe.Plug does not, both includes everything you need for graphql usage but Absinthe.Plug.GraphiQL does not “inherit” Absinthe.Plug

Great, thanks!

but Absinthe.Plug.GraphiQL does not “inherit” Absinthe.Plug

What’s the significance of this? What functionality does Absinthe.Plug have that Absinthe.Plug.GraphiQL does not?

Both have the same functionality in regards of graphql processing, but the latter provides also the explorer