Hmm… It’s very weired thing…
I’m sure check with IO.inspect that the actor is set up, but I still get an error that the actor is not provided
private: %{
:ash => %{actor: :user},
DentallogWeb.Router => ,
:phoenix_router => DentallogWeb.Router,
:plug_session_fetch => #Function<1.76384852/1 in Plug.Session.fetch_session/1>,
:before_send => [#Function<0.54455629/1 in Plug.Telemetry.call/2>,
#Function<1.28079098/1 in Phoenix.LiveReloader.before_send_inject_reloader/3>],
:phoenix_endpoint => DentallogWeb.Endpoint,
:phoenix_format => “json”,
:phoenix_request_logger => {“request_logger”, “request_logger”}
},
router.ex
pipeline :api do
plug(:accepts, ["json"])
plug(:load_from_bearer)
plug(:set_actor)
plug(AshGraphql.Plug)
end
scope "/" do
pipe_through([:api])
forward("/gql", Absinthe.Plug, schema: DentallogWeb.Schema)
forward(
"/playground",
Absinthe.Plug.GraphiQL,
schema: DentallogWeb.Schema,
interface: :playground
)
end
...
def set_actor(conn, _opts) do
IO.inspect("=======")
result = Ash.PlugHelpers.set_actor(conn, :user)
IO.inspect(result)
IO.inspect("=======")
conn
end
output
"======="
%Plug.Conn{
adapter: {Plug.Cowboy.Conn, :...},
assigns: %{},
body_params: %{
"query" => "mutation CreateDentalLabPost($input: CreateDentalLabPostInput) {\n createDentalLabPost(input: $input) {\n result {\n id\n title\n dentalLabCategory {\n name\n }\n isRevealHospital\n createdAt\n updateAt\n }\n errors {\n message\n }\n }\n}\n",
"variables" => %{
"input" => %{
"body" => "오늘 겪었던 일에 대해서 설명드릴게요",
"categoryId" => "51cb57b3-d303-4ba2-8422-ae3f3f5aa260",
"hashtags" => [%{"name" => "hashtag1"}, %{"name" => "hashtag2"}],
"isRevealHospital" => false,
"photos" => [
%{"fileName" => "foo1", "fileUrl" => "fool1.jpg"},
%{"fileName" => "foo2", "fileUrl" => "fool2.jpg"}
],
"title" => "덴탈 임상에 관하여.."
}
}
},
cookies: %{},
halted: false,
host: "localhost",
method: "POST",
owner: #PID<0.659.0>,
params: %{
"query" => "mutation CreateDentalLabPost($input: CreateDentalLabPostInput) {\n createDentalLabPost(input: $input) {\n result {\n id\n title\n dentalLabCategory {\n name\n }\n isRevealHospital\n createdAt\n updateAt\n }\n errors {\n message\n }\n }\n}\n",
"variables" => %{
"input" => %{
"body" => "오늘 겪었던 일에 대해서 설명드릴게요",
"categoryId" => "51cb57b3-d303-4ba2-8422-ae3f3f5aa260",
"hashtags" => [%{"name" => "hashtag1"}, %{"name" => "hashtag2"}],
"isRevealHospital" => false,
"photos" => [
%{"fileName" => "foo1", "fileUrl" => "fool1.jpg"},
%{"fileName" => "foo2", "fileUrl" => "fool2.jpg"}
],
"title" => "덴탈 임상에 관하여.."
}
}
},
path_info: ["gql"],
path_params: %{},
port: 4000,
private: %{
:ash => %{actor: :user},
DentallogWeb.Router => [],
:phoenix_router => DentallogWeb.Router,
:plug_session_fetch => #Function<1.76384852/1 in Plug.Session.fetch_session/1>,
:before_send => [#Function<0.54455629/1 in Plug.Telemetry.call/2>,
#Function<1.28079098/1 in Phoenix.LiveReloader.before_send_inject_reloader/3>],
:phoenix_endpoint => DentallogWeb.Endpoint,
:phoenix_format => "json",
:phoenix_request_logger => {"request_logger", "request_logger"}
},
query_params: %{},
query_string: "",
remote_ip: {127, 0, 0, 1},
req_cookies: %{},
req_headers: [
{"accept", "*/*"},
{"accept-encoding", "gzip, deflate, br"},
{"authorization",
"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ-PiAzLjEyIiwiZXhwIjoxNzA4MzA1ODY1LCJpYXQiOjE3MDgzMDQwNjUsImlzcyI6IkFzaEF1dGhlbnRpY2F0aW9uIHYzLjEyLjIiLCJqdGkiOiIydXFocXZwMTBlc2F1aWZrMWMwMDAxNTEiLCJuYmYiOjE3MDgzMDQwNjUsInB1cnBvc2UiOiJ1c2VyIiwic3ViIjoidXNlcj9pZD02OWVjMTExZS0zOTQ5LTQ3MjAtYTQxZi03MTNhM2U4MTM2YzUifQ.2zeXFGUINXpFWCyoe0rh6GI1rkyLTOSyh9msJBwhOt8eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ-PiAzLjEyIiwiZXhwIjoxNzE2MDkzODI2LCJpYXQiOjE3MDgzMTc4MjYsImlzcyI6IkFzaEF1dGhlbnRpY2F0aW9uIHYzLjEyLjIiLCJqdGkiOiIydXFpazBvZXNsajd0dGQ1azAwMDA2ajEiLCJuYmYiOjE3MDgzMTc4MjYsInB1cnBvc2UiOiJ1c2VyIiwic3ViIjoidXNlcj9pZD02OWVjMTExZS0zOTQ5LTQ3MjAtYTQxZi03MTNhM2U4MTM2YzUifQ._9t5xMBMT1creSgHd9A4tY2fgmY9bIMmeyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ-PiAzLjEyIiwiZXhwIjoxNzE2MDkzODI2LCJpYXQiOjE3MDgzMTc4MjYsImlzcyI6IkFzaEF1dGhlbnRpY2F0aW9uIHYzLjEyLjIiLCJqdGkiOiIydXFpazBvZXNsajd0dGQ1azAwMDA2ajEiLCJuYmYiOjE3MDgzMTc4MjYsInB1cnBvc2UiOiJ1c2VyIiwic3ViIjoidXNlcj9pZD02OWVjMTExZS0zOTQ5LTQ3MjAtYTQxZi03MTNhM2U4MTM2YzUifQ._9t5xMBMT1creSgHd9A4tY2fgmY9bIMmutUVEiE1YLgutUVEiE1YLg"},
{"connection", "keep-alive"},
{"content-length", "801"},
{"content-type", "application/json"},
{"host", "localhost:4000"},
{"postman-token", "30d6e47e-0422-4270-9488-840498d048b2"},
{"user-agent", "PostmanRuntime/7.36.3"}
],
request_path: "/gql",
resp_body: nil,
resp_cookies: %{},
resp_headers: [
{"cache-control", "max-age=0, private, must-revalidate"},
{"x-request-id", "F7VoFgcgpfEqlpgAACLi"}
],
scheme: :http,
script_name: [],
secret_key_base: :...,
state: :unset,
status: nil
}
"======="
[debug] ABSINTHE schema=DentallogWeb.Schema variables=%{"input" => %{"body" => "오늘 겪었던 일에 대해서 설명드릴게요", "categoryId" => "51cb57b3-d303-4ba2-8422-ae3f3f5aa260", "hashtags" => [%{"name" => "hashtag1"}, %{"name" => "hashtag2"}], "isRevealHospital" => false, "photos" => [%{"fileName" => "foo1", "fileUrl" => "fool1.jpg"}, %{"fileName" => "foo2", "fileUrl" => "fool2.jpg"}], "title" => "덴탈 임상에 관하여.."}}
---
mutation CreateDentalLabPost($input: CreateDentalLabPostInput) {
createDentalLabPost(input: $input) {
result {
id
title
dentalLabCategory {
name
}
isRevealHospital
createdAt
updateAt
}
errors {
message
}
}
}
---
[warning] `65d79afc-ac14-4936-95c8-7e9280b9058f`: AshGraphql.Error not implemented for error:
** (Ash.Error.Changes.InvalidRelationship) Invalid value provided for user: could not relate to actor, as no actor was found (and :allow_nil? is false).
(elixir 1.16.0) lib/process.ex:860: Process.info/2
(ash 2.19.3) lib/ash/error/exception.ex:59: Ash.Error.Changes.InvalidRelationship.exception/1
(ash 2.19.3) lib/ash/resource/change/relate_actor.ex:31: Ash.Resource.Change.RelateActor.change/3
(ash 2.19.3) lib/ash/changeset/changeset.ex:1782: anonymous fn/6 in Ash.Changeset.run_action_changes/6
(elixir 1.16.0) lib/enum.ex:2528: Enum."-reduce/3-lists^foldl/2-0-"/3
(ash 2.19.3) lib/ash/changeset/changeset.ex:1319: Ash.Changeset.do_for_action/4
(ash_graphql 0.26.9) lib/graphql/resolver.ex:1037: 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.11) lib/phoenix/router/route.ex:42: Phoenix.Router.Route.call/2
(phoenix 1.7.11) lib/phoenix/router.ex:484: Phoenix.Router.__call__/5
(dentallog 0.1.0) lib/dentallog_web/endpoint.ex:1: DentallogWeb.Endpoint.plug_builder_call/2