Missing something with Absinthe Plug resolver

Trying to get a basic graphql api working and running into an issue writing a resolver:

my code:

running the resolver with the query:

 thing { 
 	numba
 }
}```

** (ArgumentError) argument error
        :erlang.apply(:ok, %{numba: "12345"}, [])
(absinthe) lib/absinthe/resolution.ex:149: Absinthe.Resolution.call/2
etc. etc.

Any ideas?  This is very similar to one of the examples on the absinthe site so kind of frustrating.

I think resolve/1 accepts a function.

defmodule Mezzey.Schema do
  use Absinthe.Schema
  import_types Mezzey.Schema.Types

  @thing %{numba: "12345"}

  query do
    field :thing, :thing do
      resolve(fn _, _ -> {:ok, @thing} end)
    end
  end
end
2 Likes

Ahhhh! I knew it was something obvious, thanks.

Ah yes, let me see if I can add some better error checking here so that at least you can get a nice error message.

1 Like