Closed smt116 closed 4 months ago
I have the following GraphQL mutation:
update :update_current_round_up, :update do identity false read_action :get_current_by_actor end
After upgrading to Ash 3.x (and newest gql lib), the test with:
conn |> put_req_header("authorization", token) |> post("/graphql", %{ "query" => """ mutation ($input: UpdateCurrentRoundUpInput!) { updateCurrentRoundUp(input: $input) { result { id } } } """, "variables" => %{ "input" => %{ "multiplier" => 2 } } }) |> json_response(:ok)
fails with meaningless
%{ "data" => nil, "errors" => [%{"code" => "something_went_wrong", "fields" => [], "locations" => [%{"column" => 3, "line" => 2}], "message" => "Something went wrong. Unique error id: `81c19f37-223b-47bd-bd5c-eadbb244f1d5`", "path" => ["updateCurrentRoundUp"], "short_message" => "Something went wrong.", "vars" => %{}}] }
stacktrace:
10:59:35.242 function=log_exception/2 module=AshGraphql.Graphql.Resolver request_id=F9r5Wn6QBs614ZgAAAKF user_id=59def0dd-ffa0-4141-915c-e0646ec4cfd6 [error] 81c19f37-223b-47bd-bd5c-eadbb244f1d5: Exception raised while resolving query. ** (Protocol.UndefinedError) protocol Enumerable not implemented for nil of type Atom. This protocol is implemented for the following type(s): DBConnection.PrepareStream, DBConnection.Stream, Date.Range, Ecto.Adapters.SQL.Stream, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, Jason.OrderedObject, List, Map, MapSet, Phoenix.LiveView.LiveStream, Postgrex.Stream, Range, Req.Response.Async, Rewrite, Stream, StreamData, Timex.Interval (elixir 1.15.7) lib/enum.ex:1: Enumerable.impl_for!/1 (elixir 1.15.7) lib/enum.ex:166: Enumerable.reduce/3 (elixir 1.15.7) lib/enum.ex:4387: Enum.reverse/1 (elixir 1.15.7) lib/enum.ex:3704: Enum.to_list/1 (elixir 1.15.7) lib/map.ex:224: Map.new_from_enum/1 (ash_graphql 1.1.0) lib/graphql/resolver.ex:1270: AshGraphql.Graphql.Resolver.mutate/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 (coinbits 2.0.0) lib/coinbits_web/endpoint.ex:1: CoinbitsWeb.Endpoint.plug_builder_call/2 (coinbits 2.0.0) lib/coinbits_web/endpoint.ex:1: CoinbitsWeb.Endpoint.call/2 (phoenix 1.7.12) lib/phoenix/test/conn_test.ex:225: Phoenix.ConnTest.dispatch/5 test/coinbits_web/graphql/dca/update_current_round_up_test.exs:49: CoinbitsWeb.GraphQL.DCA.UpdateCurrentRoundUpTest."test returns not found on missing round up"/1 (ex_unit 1.15.7) lib/ex_unit/runner.ex:463: ExUnit.Runner.exec_test/2 (stdlib 5.0.2) timer.erl:270: :timer.tc/2 (ex_unit 1.15.7) lib/ex_unit/runner.ex:385: anonymous fn/5 in ExUnit.Runner.spawn_test_monitor/4
read action is defined as:
read :get_current_by_actor do get? true filter expr(user_id == ^actor(:id) and state in [:paused, :pending]) end
ash, "3.0.12" ash_appsignal, "0.1.3" ash_authentication, "4.0.0" ash_authentication_phoenix, "2.0.0" ash_graphql, "1.1.0" ash_oban, "0.2.3" ash_phoenix, "2.0.2" ash_postgres, "2.0.8" ash_sql, "0.2.3" ash_state_machine, "0.2.4"
Fixed in main.
main
I have the following GraphQL mutation:
After upgrading to Ash 3.x (and newest gql lib), the test with:
fails with meaningless
stacktrace:
read action is defined as:
ash, "3.0.12" ash_appsignal, "0.1.3" ash_authentication, "4.0.0" ash_authentication_phoenix, "2.0.0" ash_graphql, "1.1.0" ash_oban, "0.2.3" ash_phoenix, "2.0.2" ash_postgres, "2.0.8" ash_sql, "0.2.3" ash_state_machine, "0.2.4"