BryanJBryce

BryanJBryce

AshGraphQL Error when setting paginate_with: nil

I just updated to Ash 3.0 here are my versions:

      {:ash, "~> 3.0.0-rc.29"},
      {:ash_postgres, "~> 2.0.0-rc.11"},
      {:ash_phoenix, "~> 2.0.0-rc.7"},
      {:ash_authentication, "~> 4.0.0-rc.6"},
      {:ash_authentication_phoenix, "~> 2.0.0-rc.2"},
      {:ash_graphql, "~> 1.0.0-rc.3"}

I have a Company Resource with attributes of id, name, and domain.

And I’ve set the default accept on actions to :*

 actions do
    default_accept :*
    defaults [:create, :read, :update, :destroy]

And the following GraphQL configuration:

   graphql do
    type :company

    queries do
      list :list_companies, :read, paginate_with: nil
      get :exists, :by_domain
      get :company_by_id, :by_id
    end

    mutations do
    end
  end

By default, list companies works with pagination. When paginate_with: nil the generated schema shows that it should return [Company!]! like you would expect but when I call the query via GraqhQL I get an error that seems like it’s still trying to use pagination somewhere:

[error] 3bd03236-83ff-4ca6-9a20-8e8ffdf15eab: Exception raised while resolving query.

** (KeyError) key :name not found in: %{
count: %Absinthe.Type.Field{
identifier: :count,
name: “count”,
description: “Total count on all pages”,
type: :integer,
deprecation: nil,
args: %{},
config: nil,
triggers: ,
middleware: [{Absinthe.Middleware.MapGet, :count}],
complexity: nil,
default_value: nil,
private: ,
definition: App.GraphqlSchema,
reference: %{
module: AshGraphql.Resource,
location: %{
line: 3296,
file: “/Users/bryan/one-dashboard/app/deps/ash_graphql/lib/resource/resource.ex”
}
}
},
results: %Absinthe.Type.Field{
identifier: :results,
name: “results”,
description: “The records contained in the page”,
type: %Absinthe.Type.List{
of_type: %Absinthe.Type.NonNull{of_type: :company}
},
deprecation: nil,
args: %{},
config: nil,
triggers: ,
middleware: [{Absinthe.Middleware.MapGet, :results}],
complexity: nil,
default_value: nil,
private: ,
definition: App.GraphqlSchema,
reference: %{
module: AshGraphql.Resource,
location: %{
line: 3396,
file: “/Users/bryan/one-dashboard/app/deps/ash_graphql/lib/resource/resource.ex”
}
}
},
start_keyset: %Absinthe.Type.Field{
identifier: :start_keyset,
name: “start_keyset”,
description: “The first keyset in the results”,
type: :string,
deprecation: nil,
args: %{},
config: nil,
triggers: ,
middleware: [{Absinthe.Middleware.MapGet, :start_keyset}],
complexity: nil,
default_value: nil,
private: ,
definition: App.GraphqlSchema,
reference: %{
module: AshGraphql.Resource,
location: %{
line: 3409,
file: “/Users/bryan/one-dashboard/app/deps/ash_graphql/lib/resource/resource.ex”
}
}
},
end_keyset: %Absinthe.Type.Field{
identifier: :end_keyset,
name: “end_keyset”,
description: "The last k

:erlang.map_get(:name, %{count: %Absinthe.Type.Field{identifier: :count, name: "count", description: "Total count on all pages", type: :integer, deprecation: nil, args: %{}, config: nil, triggers: [], middleware: [{Absinthe.Middleware.MapGet, :count}], complexity: nil, default_value: nil, __private__: [], definition: App.GraphqlSchema, __reference__: %{module: AshGraphql.Resource, location: %{line: 3296, file: "/Users/bryan/one-dashboard/app/deps/ash_graphql/lib/resource/resource.ex"}}}, results: %Absinthe.Type.Field{identifier: :results, name: "results", description: "The records contained in the page", type: %Absinthe.Type.List{of_type: %Absinthe.Type.NonNull{of_type: :company}}, deprecation: nil, args: %{}, config: nil, triggers: [], middleware: [{Absinthe.Middleware.MapGet, :results}], complexity: nil, default_value: nil, __private__: [], definition: App.GraphqlSchema, __reference__: %{module: AshGraphql.Resource, location: %{line: 3396, file: "/Users/bryan/one-dashboard/app/deps/ash_graphql/lib/resource/resource.ex"}}}, start_keyset: %Absinthe.Type.Field{identifier: :start_keyset, name: "start_keyset", description: "The first keyset in the results", type: :string, deprecation: nil, args: %{}, config: nil, triggers: [], middleware: [{Absinthe.Middleware.MapGet, :start_keyset}], complexity: nil, default_value: nil, __private__: [], definition: App.GraphqlSchema, __reference__: %{module: AshGraphql.Resource, location: %{line: 3409, file: "/Users/bryan/one-dashboard/app/deps/ash_graphql/lib/resource/resource.ex"}}}, end_keyset: %Absinthe.Type.Field{identifier: :end_keyset, name: "end_keyset", description: "The last keyset in the results", type: :string, deprecation: nil, args: %{}, config: nil, triggers: [], middleware: [{Absinthe.Middleware.MapGet, :end_keyset}], complexity: nil, default_value: nil, __private__: [], definition: App.GraphqlSchema, __reference__: %{module: AshGraphql.Resource, location: %{line: 3417, file: "/Users/bryan/one-dashboard/app/deps/ash_graphql/lib/resource/resource.ex"}}}, __typename: %Absinthe.Type.Field{identifier: :__typename, name: "__typename", description: "The name of the object type currently being queried.", type: :string, deprecation: nil, args: %{}, config: 0, triggers: %{}, middleware: [{{Absinthe.Middleware, :shim}, {:keyset_page_of_company, :__typename, [{:ref, Absinthe.Phase.Schema.Introspection, :typename}]}}], complexity: 0, default_value: nil, __private__: [], definition: Absinthe.Phase.Schema.Introspection, __reference__: %{module: Absinthe.Phase.Schema.Introspection, location: %{line: 74, file: "/Users/bryan/one-dashboard/app/deps/absinthe/lib/absinthe/phase/schema/introspection.ex"}}}})
(absinthe 1.7.6) lib/absinthe/resolution/projector.ex:136: Absinthe.Resolution.Projector.update_schema_node/2
(absinthe 1.7.6) lib/absinthe/resolution/projector.ex:53: Absinthe.Resolution.Projector.do_collect/6
(absinthe 1.7.6) lib/absinthe/resolution/projector.ex:41: Absinthe.Resolution.Projector.collect/3
(absinthe 1.7.6) lib/absinthe/resolution/projector.ex:29: Absinthe.Resolution.Projector.project/5
(absinthe 1.7.6) lib/absinthe/resolution.ex:190: Absinthe.Resolution.project/2
(ash_graphql 1.0.0-rc.3) lib/graphql/resolver.ex:763: AshGraphql.Graphql.Resolver.validate_resolve_opts/6
(ash_graphql 1.0.0-rc.3) lib/graphql/resolver.ex:425: AshGraphql.Graphql.Resolver.resolve/2
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:234: Absinthe.Phase.Document.Execution.Resolution.reduce_resolution/1
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:189: Absinthe.Phase.Document.Execution.Resolution.do_resolve_field/3
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:174: Absinthe.Phase.Document.Execution.Resolution.do_resolve_fields/6
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:145: Absinthe.Phase.Document.Execution.Resolution.resolve_fields/4
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:88: Absinthe.Phase.Document.Execution.Resolution.walk_result/5
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:67: Absinthe.Phase.Document.Execution.Resolution.perform_resolution/3
(absinthe 1.7.6) lib/absinthe/phase/document/execution/resolution.ex:24: Absinthe.Phase.Document.Execution.Resolution.resolve_current/3
(absinthe 1.7.6) lib/absinthe/pipeline.ex:408: Absinthe.Pipeline.run_phase/3
(absinthe_plug 1.5.8) lib/absinthe/plug.ex:536: Absinthe.Plug.run_query/4
(absinthe_plug 1.5.8) lib/absinthe/plug.ex:290: Absinthe.Plug.call/2
(phoenix 1.7.12) lib/phoenix/router/route.ex:42: Phoenix.Router.Route.call/2
(phoenix 1.7.12) lib/phoenix/router.ex:484: Phoenix.Router.__call__/5

Marked As Solved

zachdaniel

zachdaniel

Creator of Ash

Can you try the latest release candidate of ash_graphql?

Also Liked

BryanJBryce

BryanJBryce

Hey, it works!

Where Next?

Popular in Questions Top

shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
vac
Hi, I’m quite new in Elixir and I’m trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and I...
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> somethi...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
dotdotdotPaul
Okay, I’m having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I’m sure I’...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Other popular topics Top

johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31142 143
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36128 110
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

We're in Beta

About us Mission Statement