When calling password_reset_with_password
from AshGraphQL it will fail since the update mutation expects me to be logged.
Calling the action directly from IEX works fine.
Here is how I added it to my graphql block:
graphql do
...
mutations do
update :password_reset_with_password, :password_reset_with_password do
identity false
end
...
end
end
This is how I’m calling it:
passwordResetWithPassword(
input: {
password: "12345678"
passwordConfirmation: "12345678"
resetToken: "my reset token"
}
) {
metadata {
token
}
result {
fullName
email
}
errors {
message
}
}
From the terminal, I get this error:
SELECT u0."id", u0."email", u0."hashed_password", u0."phone_number", u0."first_name", u0."surname", u0."roles", u0."organization_roles", u0."confirmed_at", u0."active?", u0."referral_code", u0."normalized_full_name", u0."inserted_at", u0."updated_at", u0."organization_id", u0."created_by_id", u0."referred_by_id" FROM "users" AS u0 []
[warning] `1a4e5e6f-8131-42b8-bcdb-bc3e71bc818b`: AshGraphql.Error not implemented for error:
** (Ash.Error.Invalid.MultipleResults) expected at most one result but got at least 15.
Please ensure your action is configured with an appropriate filter to ensure a single result is returned.
(ash 2.14.17) lib/ash/api/api.ex:1948: Ash.Api.unwrap_one/1
(ash 2.14.17) lib/ash/api/api.ex:1930: Ash.Api.unwrap_one/1
(marketplace 1.3.2) lib/marketplace/accounts.ex:1: Marketplace.Accounts.read_one/2
(ash_graphql 0.26.6) lib/graphql/resolver.ex:1137: AshGraphql.Graphql.Resolver.mutate/2
(absinthe 1.7.5) lib/absinthe/phase/document/execution/resolution.ex:234: Absinthe.Phase.Document.Execution.Resolution.reduce_resolution/1
(absinthe 1.7.5) lib/absinthe/phase/document/execution/resolution.ex:189: Absinthe.Phase.Document.Execution.Resolution.do_resolve_field/3
(absinthe 1.7.5) lib/absinthe/phase/document/execution/resolution.ex:174: Absinthe.Phase.Document.Execution.Resolution.do_resolve_fields/6
(absinthe 1.7.5) lib/absinthe/phase/document/execution/resolution.ex:145: Absinthe.Phase.Document.Execution.Resolution.resolve_fields/4
(absinthe 1.7.5) lib/absinthe/phase/document/execution/resolution.ex:88: Absinthe.Phase.Document.Execution.Resolution.walk_result/5
(absinthe 1.7.5) lib/absinthe/phase/document/execution/resolution.ex:67: Absinthe.Phase.Document.Execution.Resolution.perform_resolution/3
(absinthe 1.7.5) lib/absinthe/phase/document/execution/resolution.ex:24: Absinthe.Phase.Document.Execution.Resolution.resolve_current/3
(absinthe 1.7.5) 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.9) lib/phoenix/router/route.ex:42: Phoenix.Router.Route.call/2
(phoenix 1.7.9) lib/phoenix/router.ex:432: Phoenix.Router.__call__/5
(marketplace 1.3.2) lib/marketplace_web/endpoint.ex:1: MarketplaceWeb.Endpoint.plug_builder_call/2
(marketplace 1.3.2) deps/plug/lib/plug/debugger.ex:136: MarketplaceWeb.Endpoint."call (overridable 3)"/2
(marketplace 1.3.2) lib/marketplace_web/endpoint.ex:1: MarketplaceWeb.Endpoint."call (overridable 4)"/2
(marketplace 1.3.2) lib/marketplace_web/endpoint.ex:1: MarketplaceWeb.Endpoint.call/2
(phoenix 1.7.9) lib/phoenix/endpoint/sync_code_reload_plug.ex:22: Phoenix.Endpoint.SyncCodeReloadPlug.do_call/4
(plug_cowboy 2.6.1) lib/plug/cowboy/handler.ex:11: Plug.Cowboy.Handler.init/2
(cowboy 2.10.0) /home/jeferson/workspace/rebuilt/platform/marketplace/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
(cowboy 2.10.0) /home/jeferson/workspace/rebuilt/platform/marketplace/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
(cowboy 2.10.0) /home/jeferson/workspace/rebuilt/platform/marketplace/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
(stdlib 5.0.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
Seems like it is trying to find a user, but since I’m not logged (I mean, I’m resetting the password, so I can’t be logged first since I don’t know the initial password anyway), it will just query the full users table without a filter.