`AshGraphql.Error` not implemented

Looks like a policy error is being raised and not caught somewhere:
[warning] `fb1756e7-6a42-43c1-a11c-9758d305ac78`: AshGraphql.Error not implemented for error:

** (ErlangError) Erlang error: {%Ash.Error.Forbidden{errors: [%Ash.Error.Forbidden.Policy{scenarios: [], facts: %{false => false, true => true...
[warning] `fb1756e7-6a42-43c1-a11c-9758d305ac78`: AshGraphql.Error not implemented for error:

** (ErlangError) Erlang error: {%Ash.Error.Forbidden{errors: [%Ash.Error.Forbidden.Policy{scenarios: [], facts: %{false => false, true => true...
12 Replies
\ ឵឵឵
\ ឵឵឵OP3y ago
Here's the trace:
(ash 2.6.31) lib/ash/error/forbidden/policy.ex:26: Ash.Error.Forbidden.Policy.exception/1
(ash 2.6.31) lib/ash/policy/authorizer.ex:796: Ash.Policy.Authorizer.strict_check_result/1
(ash 2.6.31) lib/ash/policy/authorizer.ex:372: Ash.Policy.Authorizer.strict_check/2
(ash 2.6.31) lib/ash/engine/request.ex:554: Ash.Engine.Request.do_strict_check/3
(ash 2.6.31) lib/ash/engine/request.ex:522: anonymous fn/2 in Ash.Engine.Request.strict_check/2
(elixir 1.14.4) lib/enum.ex:4751: Enumerable.List.reduce/3
(elixir 1.14.4) lib/enum.ex:2514: Enum.reduce_while/3
(ash 2.6.31) lib/ash/engine/request.ex:255: Ash.Engine.Request.do_next/1
(ash 2.6.31) lib/ash/engine/request.ex:211: Ash.Engine.Request.next/1
(ash 2.6.31) lib/ash/engine/engine.ex:719: Ash.Engine.advance_request/2
(ash 2.6.31) lib/ash/engine/engine.ex:625: Ash.Engine.fully_advance_request/2
(ash 2.6.31) lib/ash/engine/engine.ex:566: Ash.Engine.do_run_iteration/2
(elixir 1.14.4) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
(ash 2.6.31) lib/ash/error/forbidden/policy.ex:26: Ash.Error.Forbidden.Policy.exception/1
(ash 2.6.31) lib/ash/policy/authorizer.ex:796: Ash.Policy.Authorizer.strict_check_result/1
(ash 2.6.31) lib/ash/policy/authorizer.ex:372: Ash.Policy.Authorizer.strict_check/2
(ash 2.6.31) lib/ash/engine/request.ex:554: Ash.Engine.Request.do_strict_check/3
(ash 2.6.31) lib/ash/engine/request.ex:522: anonymous fn/2 in Ash.Engine.Request.strict_check/2
(elixir 1.14.4) lib/enum.ex:4751: Enumerable.List.reduce/3
(elixir 1.14.4) lib/enum.ex:2514: Enum.reduce_while/3
(ash 2.6.31) lib/ash/engine/request.ex:255: Ash.Engine.Request.do_next/1
(ash 2.6.31) lib/ash/engine/request.ex:211: Ash.Engine.Request.next/1
(ash 2.6.31) lib/ash/engine/engine.ex:719: Ash.Engine.advance_request/2
(ash 2.6.31) lib/ash/engine/engine.ex:625: Ash.Engine.fully_advance_request/2
(ash 2.6.31) lib/ash/engine/engine.ex:566: Ash.Engine.do_run_iteration/2
(elixir 1.14.4) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
(ash 2.6.31) lib/ash/engine/engine.ex:509: Ash.Engine.run_iteration/1
(ash 2.6.31) lib/ash/engine/engine.ex:307: Ash.Engine.run_to_completion/1
(ash 2.6.31) lib/ash/engine/engine.ex:252: Ash.Engine.do_run/2
(ash 2.6.31) lib/ash/engine/engine.ex:148: Ash.Engine.run/2
(ash 2.6.31) lib/ash/actions/read.ex:173: Ash.Actions.Read.do_run/3
(ash 2.6.31) lib/ash/error/error.ex:461: Ash.Error.choose_error/2
(ash 2.6.31) lib/ash/error/error.ex:218: Ash.Error.to_error_class/2
(ash 2.6.31) lib/ash/actions/read.ex:184: Ash.Actions.Read.do_run/3
(ash 2.6.31) lib/ash/actions/read.ex:96: Ash.Actions.Read.run/3
(ash 2.6.31) lib/ash/api/api.ex:1315: Ash.Api.load!/4
(ash_graphql 0.23.3) lib/graphql/dataloader.ex:255: Dataloader.Source.AshGraphql.Dataloader.run_batch/2
(ash_graphql 0.23.3) lib/graphql/dataloader.ex:182: anonymous fn/2 in Dataloader.Source.AshGraphql.Dataloader.run_batches/1
(elixir 1.14.4) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2
(elixir 1.14.4) lib/task/supervised.ex:34: Task.Supervised.reply/4
(stdlib 4.3) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
(ash 2.6.31) lib/ash/engine/engine.ex:509: Ash.Engine.run_iteration/1
(ash 2.6.31) lib/ash/engine/engine.ex:307: Ash.Engine.run_to_completion/1
(ash 2.6.31) lib/ash/engine/engine.ex:252: Ash.Engine.do_run/2
(ash 2.6.31) lib/ash/engine/engine.ex:148: Ash.Engine.run/2
(ash 2.6.31) lib/ash/actions/read.ex:173: Ash.Actions.Read.do_run/3
(ash 2.6.31) lib/ash/error/error.ex:461: Ash.Error.choose_error/2
(ash 2.6.31) lib/ash/error/error.ex:218: Ash.Error.to_error_class/2
(ash 2.6.31) lib/ash/actions/read.ex:184: Ash.Actions.Read.do_run/3
(ash 2.6.31) lib/ash/actions/read.ex:96: Ash.Actions.Read.run/3
(ash 2.6.31) lib/ash/api/api.ex:1315: Ash.Api.load!/4
(ash_graphql 0.23.3) lib/graphql/dataloader.ex:255: Dataloader.Source.AshGraphql.Dataloader.run_batch/2
(ash_graphql 0.23.3) lib/graphql/dataloader.ex:182: anonymous fn/2 in Dataloader.Source.AshGraphql.Dataloader.run_batches/1
(elixir 1.14.4) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2
(elixir 1.14.4) lib/task/supervised.ex:34: Task.Supervised.reply/4
(stdlib 4.3) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
ZachDaniel
ZachDaniel3y ago
🤔 interesting In that case its showing an Erlang error is that the whole message? Can you show more?
\ ឵឵឵
\ ឵឵឵OP3y ago
I think I tracked it down to a missing alias for the module in accessing_from. Probably this should be raised as-is. Out of curiosity, should accessing_from be available in expr? Or how would one do || with accessing_from?
ZachDaniel
ZachDaniel3y ago
You wouldn't, accessing_from is a check, and so would need to be arranged via combinations of check types i.e
authorize_if accessing_from(...)
authorize_if expr(name == "fred")
authorize_if accessing_from(...)
authorize_if expr(name == "fred")
That would be accessing from ... or expr(name == "fred"), for example
\ ឵឵឵
\ ឵឵឵OP3y ago
Ah, yes, so I want to say:
policy [action_type(:read), expr(accessing_from(...) || accessing_from(...)] do
authorize_if always()
end
policy [action_type(:read), expr(accessing_from(...) || accessing_from(...)] do
authorize_if always()
end
Right now I simply have it broken into two policies.
ZachDaniel
ZachDaniel3y ago
Ah, yeah I see what you mean. Unfortunately there is no way to do that currently (but additional policies for example would do it) You can also copy the accessing_from implementation and write your own that does the || inside the check policy [action_type(:read), AccessingFromFooOrBar] can you show me the missing alias that you're talking about? oh, you mean in your own code Yeah, so thats not the reason you got an Erlang error ** (ErlangError) Erlang error: {%Ash.Error.Forbidden{errors: [%Ash.Error.Forbidden.Policy{scenarios: [], facts: %{false => false, true => true... Somewhere we pattern matched on something wrong it seems like can I see more of the error message?
\ ឵឵឵
\ ឵឵឵OP3y ago
Agreed, think that was surfacing it though Yep, just a sec
error] Task #PID<0.3058.0> started from #PID<0.3056.0> terminating
** (Ash.Error.Forbidden) Forbidden

* forbidden:

App.Post.read
(ash 2.6.31) lib/ash/error/forbidden/policy.ex:26: Ash.Error.Forbidden.Policy.exception/1
(ash 2.6.31) lib/ash/policy/authorizer.ex:774: Ash.Policy.Authorizer.strict_check_result/1
(ash 2.6.31) lib/ash/policy/authorizer.ex:372: Ash.Policy.Authorizer.strict_check/2
(ash 2.6.31) lib/ash/engine/request.ex:554: Ash.Engine.Request.do_strict_check/3
(ash 2.6.31) lib/ash/engine/request.ex:522: anonymous fn/2 in Ash.Engine.Request.strict_check/2
(elixir 1.14.4) lib/enum.ex:4751: Enumerable.List.reduce/3
(elixir 1.14.4) lib/enum.ex:2514: Enum.reduce_while/3
(ash 2.6.31) lib/ash/engine/request.ex:255: Ash.Engine.Request.do_next/1
(ash 2.6.31) lib/ash/engine/request.ex:211: Ash.Engine.Request.next/1
(ash 2.6.31) lib/ash/engine/engine.ex:719: Ash.Engine.advance_request/2
(ash 2.6.31) lib/ash/engine/engine.ex:625: Ash.Engine.fully_advance_request/2
(ash 2.6.31) lib/ash/engine/engine.ex:566: Ash.Engine.do_run_iteration/2
(elixir 1.14.4) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
(ash 2.6.31) lib/ash/engine/engine.ex:509: Ash.Engine.run_iteration/1
(ash 2.6.31) lib/ash/engine/engine.ex:307: Ash.Engine.run_to_completion/1
(ash 2.6.31) lib/ash/engine/engine.ex:252: Ash.Engine.do_run/2
(ash 2.6.31) lib/ash/engine/engine.ex:148: Ash.Engine.run/2
(ash 2.6.31) lib/ash/actions/read.ex:173: Ash.Actions.Read.do_run/3
(ash 2.6.31) lib/ash/error/error.ex:461:
error] Task #PID<0.3058.0> started from #PID<0.3056.0> terminating
** (Ash.Error.Forbidden) Forbidden

* forbidden:

App.Post.read
(ash 2.6.31) lib/ash/error/forbidden/policy.ex:26: Ash.Error.Forbidden.Policy.exception/1
(ash 2.6.31) lib/ash/policy/authorizer.ex:774: Ash.Policy.Authorizer.strict_check_result/1
(ash 2.6.31) lib/ash/policy/authorizer.ex:372: Ash.Policy.Authorizer.strict_check/2
(ash 2.6.31) lib/ash/engine/request.ex:554: Ash.Engine.Request.do_strict_check/3
(ash 2.6.31) lib/ash/engine/request.ex:522: anonymous fn/2 in Ash.Engine.Request.strict_check/2
(elixir 1.14.4) lib/enum.ex:4751: Enumerable.List.reduce/3
(elixir 1.14.4) lib/enum.ex:2514: Enum.reduce_while/3
(ash 2.6.31) lib/ash/engine/request.ex:255: Ash.Engine.Request.do_next/1
(ash 2.6.31) lib/ash/engine/request.ex:211: Ash.Engine.Request.next/1
(ash 2.6.31) lib/ash/engine/engine.ex:719: Ash.Engine.advance_request/2
(ash 2.6.31) lib/ash/engine/engine.ex:625: Ash.Engine.fully_advance_request/2
(ash 2.6.31) lib/ash/engine/engine.ex:566: Ash.Engine.do_run_iteration/2
(elixir 1.14.4) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
(ash 2.6.31) lib/ash/engine/engine.ex:509: Ash.Engine.run_iteration/1
(ash 2.6.31) lib/ash/engine/engine.ex:307: Ash.Engine.run_to_completion/1
(ash 2.6.31) lib/ash/engine/engine.ex:252: Ash.Engine.do_run/2
(ash 2.6.31) lib/ash/engine/engine.ex:148: Ash.Engine.run/2
(ash 2.6.31) lib/ash/actions/read.ex:173: Ash.Actions.Read.do_run/3
(ash 2.6.31) lib/ash/error/error.ex:461:
Ash.Error.choose_error/2
(ash 2.6.31) lib/ash/error/error.ex:218: Ash.Error.to_error_class/2
(ash 2.6.31) lib/ash/actions/read.ex:184: Ash.Actions.Read.do_run/3
(ash 2.6.31) lib/ash/actions/read.ex:96: Ash.Actions.Read.run/3
(ash 2.6.31) lib/ash/api/api.ex:1315: Ash.Api.load!/4
(ash_graphql 0.23.3) lib/graphql/dataloader.ex:255: Dataloader.Source.AshGraphql.Dataloader.run_batch/2
(ash_graphql 0.23.3) lib/graphql/dataloader.ex:182: anonymous fn/2 in Dataloader.Source.AshGraphql.Dataloader.run_batches/1
(elixir 1.14.4) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2
(elixir 1.14.4) lib/task/supervised.ex:34: Task.Supervised.reply/4
(stdlib 4.3) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Function: &:erlang.apply/2
Args: [#Function<13.123878446/1 in
Dataloader.Source.AshGraphql.Dataloader.run_batches/1>, [{{:assoc,
App.Post, #PID<0.2982.0>, :tags, App.Tag, %{api_opts:
[actor: [--REDACTED--], aggregates: %{}, calculations: %{},
__order__: nil, ...>}])}]]
Ash.Error.choose_error/2
(ash 2.6.31) lib/ash/error/error.ex:218: Ash.Error.to_error_class/2
(ash 2.6.31) lib/ash/actions/read.ex:184: Ash.Actions.Read.do_run/3
(ash 2.6.31) lib/ash/actions/read.ex:96: Ash.Actions.Read.run/3
(ash 2.6.31) lib/ash/api/api.ex:1315: Ash.Api.load!/4
(ash_graphql 0.23.3) lib/graphql/dataloader.ex:255: Dataloader.Source.AshGraphql.Dataloader.run_batch/2
(ash_graphql 0.23.3) lib/graphql/dataloader.ex:182: anonymous fn/2 in Dataloader.Source.AshGraphql.Dataloader.run_batches/1
(elixir 1.14.4) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2
(elixir 1.14.4) lib/task/supervised.ex:34: Task.Supervised.reply/4
(stdlib 4.3) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Function: &:erlang.apply/2
Args: [#Function<13.123878446/1 in
Dataloader.Source.AshGraphql.Dataloader.run_batches/1>, [{{:assoc,
App.Post, #PID<0.2982.0>, :tags, App.Tag, %{api_opts:
[actor: [--REDACTED--], aggregates: %{}, calculations: %{},
__order__: nil, ...>}])}]]
Had to redact, user data, let me know if it's still useful.
ZachDaniel
ZachDaniel3y ago
🤔 I'm still not seeing the Erlang error part you originally mentioned
ZachDaniel
ZachDaniel3y ago
Very strange...are you on the latest ash/ash_graphql?
\ ឵឵឵
\ ឵឵឵OP3y ago
d4ee7c5ac237eb4876fbf5f96248b340c74d5253
ZachDaniel
ZachDaniel3y ago
Can you open this as an issue on ash_graphql? Want to track it, but don't have time to fix it at the moment

Did you find this page helpful?