Hello
I’m in the middle of changing to an Ash.3.0 migration and have encountered an error.
resource.ex
defmodule Dentallog.QuestionAnswer.QuestionPost do
use Ash.Resource,
domain: Dentallog.QuestionAnswer,
data_layer: AshPostgres.DataLayer,
extensions: [
AshArchival.Resource,
AshPaperTrail.Resource,
AshGraphql.Resource
]
graphql do
type :question_answer_post
queries do
get(:get_question_answer_post, :read)
list(:list_question_answer_post, :list)
end
mutations do
create :create_question_answer_post, :create
update :update_question_answer_post, :update
update :increment_view_count, :increment_view_count
destroy :delete_question_answer_post, :destroy
end
managed_relationships do
managed_relationship(:create, :photos, ignore?: true)
managed_relationship(:update, :photos, ignore?: true)
managed_relationship(:create, :question_answer_post_category, ignore?: true)
managed_relationship(:create, :pre_diary, ignore?: true)
managed_relationship(:create, :post_diary, ignore?: true)
end
end
aggregates do
first :thumbnail_url, :photos, :photo_url
count :count_of_comments, :comments
end
actions do
defaults [:read, :destroy]
create :create do
accept [:title, :body, :question_answer_post_category_id, :pre_diary_id, :post_diary_id]
argument :photos, {:array, :map}, allow_nil?: true
change relate_actor(:user)
change manage_relationship(:photos, type: :create)
end
read :list do
pagination keyset?: true, default_limit: 20, countable: true, max_page_size: 20
end
update :update do
argument :photos, {:array, :map}, allow_nil?: true
change manage_relationship(:photos, type: :direct_control)
end
update :increment_view_count do
accept []
change atomic_update(:count_of_view, expr(count_of_view + 1))
end
end
attributes do
uuid_primary_key :id, public?: true
attribute :title, :string, allow_nil?: false, public?: true
attribute :body, :string, public?: true
attribute :count_of_view, :integer, default: 0, public?: true
create_timestamp :created_at, public?: true
update_timestamp :updated_at, public?: true
end
relationships do
belongs_to :user, Dentallog.Accounts.User do
domain Dentallog.Accounts
public? true
writable? false
end
belongs_to :question_answer_post_category, Dentallog.QuestionAnswer.QuestionPostCategory do
public? true
attribute_type :integer
writable? true
end
belongs_to :pre_diary, Dentallog.DentalDiary.Diary do
domain Dentallog.DentalDiary
public? true
writable? true
end
belongs_to :post_diary, Dentallog.DentalDiary.Diary do
domain Dentallog.DentalDiary
public? true
writable? true
end
has_many :photos, Dentallog.QuestionAnswer.QuestionPostPhoto do
public? true
writable? true
end
has_many :comments, Dentallog.QuestionAnswer.QuestionPostComment do
public? true
writable? true
filter expr(is_nil(parent_id))
end
end
postgres do
table "question_posts"
repo Dentallog.Repo
end
paper_trail do
change_tracking_mode(:changes_only)
store_action_name?(true)
reference_source?(false)
end
archive do
archive_related([:photos])
end
end
script.ex
random_number = Enum.random(1..100000000000)
user =
Dentallog.Accounts.User
|> Ash.Changeset.for_create(:register_with_password, %{
email: "exam232#{random_number}@gmail.com",
nickname: "example",
phone_number: "010-1234-5678",
password: "password",
password_confirmation: "password"
})
|> Ash.create!()
Dentallog.QuestionAnswer.QuestionPost
|> Ash.Changeset.for_create(:create, %{
title: "질문 3 제목11",
body: "질문 3 내용",
question_answer_post_category_id: 3,
pre_diary_id: "190a53a7-cb2f-4a11-aee4-82c9a37000ba",
post_diary_id: "190a53a7-cb2f-4a11-aee4-82c9a37000ba"
}, actor: user)
|> Ash.create!()
I’m trying to create a resource with that code, but I keep getting an error.
stacktrace
** (Ash.Error.Invalid) got UndefinedFunctionError with message "function Ash.Error.Invalid.message/1 is undefined (module Ash.Error.Invalid is not available)" while retrieving Exception.message/1 for %{path: [], stacktrace: %{stacktrace: [{Process, :info, 2, [file: ~c"lib/process.ex", line: 860]}, {Ash.Error.Invalid, :exception, 1, [file: ~c"lib/ash/error/invalid.ex", line: 5]}, {Ash.Error, :to_class, 2, [file: ~c"/Users/dwlee/Documents/dentallog/dentallog-server/deps/splode/lib/splode.ex", line: 211]}, {Ash.Error, :to_error_class, 2, [file: ~c"lib/ash/error/error.ex", line: 33]}, {Ash.Actions.Create, :do_run, 4, [file: ~c"lib/ash/actions/create/create.ex", line: 131]}, {Ash.Actions.Create, :run, 4, [file: ~c"lib/ash/actions/create/create.ex", line: 46]}, {Ash, :create!, 2, [file: ~c"lib/ash.ex", line: 1965]}, {:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 746]}, {:elixir, :eval_forms, 4, [file: ~c"src/elixir.erl", line: 378]}, {Module.ParallelChecker, :verify, 1, [file: ~c"lib/module/parallel_checker.ex", line: 112]}, {Code, :eval_quoted, 3, [file: ~c"lib/code.ex", line: 1047]}, {:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 746]}, {:erl_eval, :expr, 6, [file: ~c"erl_eval.erl", line: 494]}, {:erl_eval, :exprs, 6, [file: ~c"erl_eval.erl", line: 136]}, {:erl_eval, :try_clauses, 10, [file: ~c"erl_eval.erl", line: 1052]}, {Code, :with_diagnostics, 2, [file: ~c"lib/code.ex", line: 617]}, {:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 746]}, {:erl_eval, :expr, 6, [file: ~c"erl_eval.erl", line: 494]}, {:erl_eval, :exprs, 6, [file: ~c"erl_eval.erl", line: 136]}, {:elixir, :eval_forms, 4, [file: ~c"src/elixir.erl", line: 378]}], __struct__: Splode.Stacktrace}, __struct__: Ash.Error.Invalid, vars: [], __exception__: true, errors: [%{message: "relationship is not editable", path: [], stacktrace: %{stacktrace: [{Process, :info, 2, [file: ~c"lib/process.ex", line: 860]}, {Ash.Error.Changes.InvalidRelationship, :exception, 1, [file: ~c"lib/ash/error/changes/invalid_relationship.ex", line: 5]}, {Ash.Changeset, :manage_relationship, 4, [file: ~c"lib/ash/changeset/changeset.ex", line: 3914]}, {Ash.Changeset, :"-run_action_changes/6-fun-3-", 6, [file: ~c"lib/ash/changeset/changeset.ex", line: 2056]}, {Enum, :"-reduce/3-lists^foldl/2-0-", 3, [file: ~c"lib/enum.ex", line: 2528]}, {Ash.Changeset, :run_action_changes, 6, [file: ~c"lib/ash/changeset/changeset.ex", line: 1985]}, {Ash.Changeset, :do_for_action, 4, [file: ~c"lib/ash/changeset/changeset.ex", line: 1534]}, {:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 746]}, {:erl_eval, :expr_list, 7, [file: ~c"erl_eval.erl", line: 1026]}, {:erl_eval, :expr, 6, [file: ~c"erl_eval.erl", line: 456]}, {:elixir, :eval_forms, 4, [file: ~c"src/elixir.erl", line: 378]}, {Module.ParallelChecker, :verify, 1, [file: ~c"lib/module/parallel_checker.ex", line: 112]}, {Code, :eval_quoted, 3, [file: ~c"lib/code.ex", line: 1047]}, {:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 746]}, {:erl_eval, :expr, 6, [file: ~c"erl_eval.erl", line: 494]}, {:erl_eval, :exprs, 6, [file: ~c"erl_eval.erl", line: 136]}, {:erl_eval, :try_clauses, 10, [file: ~c"erl_eval.erl", line: 1052]}, {Code, :with_diagnostics, 2, [file: ~c"lib/code.ex", line: 617]}, {:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 746]}, {:erl_eval, :expr, 6, [file: ~c"erl_eval.erl", line: 494]}], __struct__: Splode.Stacktrace}, __struct__: Ash.Error.Changes.InvalidRelationship, vars: [], __exception__: true, class: :invalid, relationship: :user, splode: Ash.Error, bread_crumbs: []}], class: :invalid, query: nil, splode: Ash.Error, changeset: %{atomics: [], handle_errors: nil, atomic_validations: [], to_tenant: nil, relationships: %{}, around_action: [], attributes: %{id: "1594fa3e-0264-4c1e-9bf2-4e81c429187d", title: "질문 3 제목11", body: "질문 3 내용", created_at: ~U[2024-04-30 02:42:55.105383Z], updated_at: ~U[2024-04-30 02:42:55.105383Z], question_answer_post_category_id: 3, pre_diary_id: "190a53a7-cb2f-4a11-aee4-82c9a37000ba", post_diary_id: "190a53a7-cb2f-4a11-aee4-82c9a37000ba", count_of_view: 0}, before_transaction: [], attribute_changes: %{id: "1594fa3e-0264-4c1e-9bf2-4e81c429187d", created_at: ~U[2024-04-30 02:42:55.105383Z], updated_at: ~U[2024-04-30 02:42:55.105383Z], count_of_view: 0}, invalid_keys: MapSet.new([]), timeout: nil, load: [], domain: Dentallog.QuestionAnswer, params: %{title: "질문 3 제목11", body: "질문 3 내용", question_answer_post_category_id: 3, pre_diary_id: "190a53a7-cb2f-4a11-aee4-82c9a37000ba", post_diary_id: "190a53a7-cb2f-4a11-aee4-82c9a37000ba"}, action_failed?: false, resource: Dentallog.QuestionAnswer.QuestionPost, filter: nil, arguments: %{}, action: %{error_handler: nil, name: :create, type: :create, accept: [:title, :body, :question_answer_post_category_id, :pre_diary_id, :post_diary_id], description: nil, manual: nil, metadata: [], arguments: [%{default: nil, name: :photos, type: {:array, Ash.Type.Map}, description: nil, __struct__: Ash.Resource.Actions.Argument, constraints: [items: [], empty_values: [""], nil_items?: false], allow_nil?: true, public?: true, sensitive?: false}], __struct__: Ash.Resource.Actions.Create, reject: [], upsert_identity: nil, upsert_fields: nil, upsert?: false, notifiers: [], changes: [%{on: nil, description: nil, where: [], __struct__: Ash.Resource.Change, always_atomic?: false, ...}, %{on: nil, description: nil, where: [], __struct__: Ash.Resource.Change, ...}], allow_nil_input: [], delay_global_validations?: false, primary?: false, require_attributes: [], skip_global_validations?: false, touches_resources: [], ...}, __struct__: Ash.Changeset, valid?: false, context: %{private: %{actor: %{id: "6e459d2b-bde9-4271-9bfa-2667bec08e48", __struct__: Dentallog.Accounts.User, token: %{type: :relationship, __struct__: Ash.NotLoaded, field: :token}, email: %{string: "exam23269522809745@gmail.com", case: nil, __struct__: Ash.CiString, casted?: false}, nickname: "example", phone_number: "010-1234-5678", calculations: %{}, aggregates: %{}, archived_at: nil, __lateral_join_source__: nil, __metadata__: %{token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ-PiA0LjAiLCJleHAiOjE3NDU5ODA5NzUsImlhdCI6MTcxNDQ0NDk3NSwiaXNzIjoiQXNoQXV0aGVudGljYXRpb24gdjQuMC4wIiwianRpIjoiMnY1ZXQ3b2VvbmIyMGplaGhjMDAwMmsxIiwibmJmIjoxNzE0NDQ0OTc1LCJwdXJwb3NlIjoidXNlciIsInN1YiI6InVzZXI_aWQ9NmU0NTlkMmItYmRlOS00MjcxLTliZmEtMjY2N2JlYzA4ZTQ4In0.ZEg3TOLGIV_CjnKb4Ah9r0WDJNzcVmKf74wCvnLHtQ4", confirmation_token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY3QiOiJjb25maXJtIiwiYXVkIjoifj4gNC4wIiwiZXhwIjoxNzE0NzA0MTc1LCJpYXQiOjE3MTQ0NDQ5NzUsImlzcyI6IkFzaEF1dGhlbnRpY2F0aW9uIHY0LjAuMCIsImp0aSI6IjJ2NWV0N29mZnJ2bmdqZWhoYzAwMDJsMSIsIm5iZiI6MTcxNDQ0NDk3NSwic3ViIjoidXNlcj9pZD02ZTQ1OWQyYi1iZGU5LTQyNzEtOWJmYS0yNjY3YmVjMDhlNDgifQ.APY7zAivW077zInt3qbnXYsh-Dqf5x3xD_xwBN17PzY"}, __order__: nil, confirmed_at: nil, created_at: ~U[2024-04-30 02:42:54.788476Z], doctor_hospital_name: nil, doctor_name: nil, ...}, authorize?: true, upsert_identity: nil, upsert_fields: nil, upsert?: true}, actor: %{id: "6e459d2b-bde9-4271-9bfa-2667bec08e48", __struct__: Dentallog.Accounts.User, token: %{type: :relationship, __struct__: Ash.NotLoaded, field: :token}, email: %{string: "exam23269522809745@gmail.com", case: nil, __struct__: Ash.CiString, casted?: false}, nickname: "example", phone_number: "010-1234-5678", calculations: %{}, aggregates: %{}, archived_at: nil, __lateral_join_source__: nil, __metadata__: %{token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ-PiA0LjAiLCJleHAiOjE3NDU5ODA5NzUsImlhdCI6MTcxNDQ0NDk3NSwiaXNzIjoiQXNoQXV0aGVudGljYXRpb24gdjQuMC4wIiwianRpIjoiMnY1ZXQ3b2VvbmIyMGplaGhjMDAwMmsxIiwibmJmIjoxNzE0NDQ0OTc1LCJwdXJwb3NlIjoidXNlciIsInN1YiI6InVzZXI_aWQ9NmU0NTlkMmItYmRlOS00MjcxLTliZmEtMjY2N2JlYzA4ZTQ4In0.ZEg3TOLGIV_CjnKb4Ah9r0WDJNzcVmKf74wCvnLHtQ4", confirmation_token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY3QiOiJjb25maXJtIiwiYXVkIjoifj4gNC4wIiwiZXhwIjoxNzE0NzA0MTc1LCJpYXQiOjE3MTQ0NDQ5NzUsImlzcyI6IkFzaEF1dGhlbnRpY2F0aW9uIHY0LjAuMCIsImp0aSI6IjJ2NWV0N29mZnJ2bmdqZWhoYzAwMDJsMSIsIm5iZiI6MTcxNDQ0NDk3NSwic3ViIjoidXNlcj9pZD02ZTQ1OWQyYi1iZGU5LTQyNzEtOWJmYS0yNjY3YmVjMDhlNDgifQ.APY7zAivW077zInt3qbnXYsh-Dqf5x3xD_xwBN17PzY"}, __order__: nil, confirmed_at: nil, created_at: ~U[2024-04-30 02:42:54.788476Z], doctor_hospital_name: nil, doctor_name: nil, ...}, authorize?: true}, casted_attributes: %{title: "질문 3 제목11", body: "질문 3 내용", question_answer_post_category_id: 3, pre_diary_id: "190a53a7-cb2f-4a11-aee4-82c9a37000ba", post_diary_id: "190a53a7-cb2f-4a11-aee4-82c9a37000ba"}, before_action: [], data: %{id: nil, user: %{type: :relationship, __struct__: Ash.NotLoaded, field: :user}, title: nil, __struct__: Dentallog.QuestionAnswer.QuestionPost, body: nil, comments: %{type: :relationship, __struct__: Ash.NotLoaded, field: :comments}, calculations: %{}, aggregates: %{}, archived_at: nil, __lateral_join_source__: nil, __metadata__: %{}, __order__: nil, created_at: nil, updated_at: nil, paper_trail_versions: %{...}, ...}, phase: :pending, casted_arguments: %{}, after_action: [#Function<5.11754845/2 in AshPaperTrail.Resource.Changes.CreateNewVersion>], __validated_for_action__: :create, defaults: [:updated_at, :created_at, :id, :count_of_view], tenant: nil, select: nil, errors: [%{message: "relationship is not editable", path: [], stacktrace: %{stacktrace: [{Process, ...}, {...}, ...], __struct__: Splode.Stacktrace}, __struct__: Ash.Error.Changes.InvalidRelationship, vars: [], __exception__: true, ...}], after_transaction: [], around_transaction: [], action_type: :create}, action_input: nil, bread_crumbs: []}. Stacktrace:
Ash.Error.Invalid.message(%{path: [], stacktrace: %{stacktrace: [{Process, :info, 2, [file: ~c"lib/process.ex", line: 860]}, {Ash.Error.Invalid, :exception, 1, [file: ~c"lib/ash/error/invalid.ex", line: 5]}, {Ash.Error, :to_class, 2, [file: ~c"/Users/dwlee/Documents/dentallog/dentallog-server/deps/splode/lib/splode.ex", line: 211]}, {Ash.Error, :to_error_class, 2, [file: ~c"lib/ash/error/error.ex", line: 33]}, {Ash.Actions.Create, :do_run, 4, [file: ~c"lib/ash/actions/create/create.ex", line: 131]}, {Ash.Actions.Create, :run, 4, [file: ~c"lib/ash/actions/create/create.ex", line: 46]}, {Ash, :create!, 2, [file: ~c"lib/ash.ex", line: 1965]}, {:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 746]}, {:elixir, :eval_forms, 4, [file: ~c"src/elixir.erl", line: 378]}, {Module.ParallelChecker, :verify, 1, [file: ~c"lib/module/parallel_checker.ex", line: 112]}, {Code, :eval_quoted, 3, [file: ~c"lib/code.ex", line: 1047]}, {:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 746]}, {:erl_eval, :expr, 6, [file: ~c"erl_eval.erl", line: 494]}, {:erl_eval, :exprs, 6, [file: ~c"erl_eval.erl", line: 136]}, {:erl_eval, :try_clauses, 10, [file: ~c"erl_eval.erl", line: 1052]}, {Code, :with_diagnostics, 2, [file: ~c"lib/code.ex", line: 617]}, {:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 746]}, {:erl_eval, :expr, 6, [file: ~c"erl_eval.erl", line: 494]}, {:erl_eval, :exprs, 6, [file: ~c"erl_eval.erl", line: 136]}, {:elixir, :eval_forms, 4, [file: ~c"src/elixir.erl", line: 378]}], __struct__: Splode.Stacktrace}, __struct__: Ash.Error.Invalid, vars: [], __exception__: true, errors: [%{message: "relationship is not editable", path: [], stacktrace: %{stacktrace: [{Process, :info, 2, [file: ~c"lib/process.ex", line: 860]}, {Ash.Error.Changes.InvalidRelationship, :exception, 1, [file: ~c"lib/ash/error/changes/invalid_relationship.ex", line: 5]}, {Ash.Changeset, :manage_relationship, 4, [file: ~c"lib/ash/changeset/changeset.ex", line: 3914]}, {Ash.Changeset, :"-run_action_changes/6-fun-3-", 6, [file: ~c"lib/ash/changeset/changeset.ex", line: 2056]}, {Enum, :"-reduce/3-lists^foldl/2-0-", 3, [file: ~c"lib/enum.ex", line: 2528]}, {Ash.Changeset, :run_action_changes, 6, [file: ~c"lib/ash/changeset/changeset.ex", line: 1985]}, {Ash.Changeset, :do_for_action, 4, [file: ~c"lib/ash/changeset/changeset.ex", line: 1534]}, {:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 746]}, {:erl_eval, :expr_list, 7, [file: ~c"erl_eval.erl", line: 1026]}, {:erl_eval, :expr, 6, [file: ~c"erl_eval.erl", line: 456]}, {:elixir, :eval_forms, 4, [file: ~c"src/elixir.erl", line: 378]}, {Module.ParallelChecker, :verify, 1, [file: ~c"lib/module/parallel_checker.ex", line: 112]}, {Code, :eval_quoted, 3, [file: ~c"lib/code.ex", line: 1047]}, {:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 746]}, {:erl_eval, :expr, 6, [file: ~c"erl_eval.erl", line: 494]}, {:erl_eval, :exprs, 6, [file: ~c"erl_eval.erl", line: 136]}, {:erl_eval, :try_clauses, 10, [file: ~c"erl_eval.erl", line: 1052]}, {Code, :with_diagnostics, 2, [file: ~c"lib/code.ex", line: 617]}, {:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 746]}, {:erl_eval, :expr, 6, [file: ~c"erl_eval.erl", line: 494]}], __struct__: Splode.Stacktrace}, __struct__: Ash.Error.Changes.InvalidRelationship, vars: [], __exception__: true, class: :invalid, relationship: :user, splode: Ash.Error, bread_crumbs: []}], class: :invalid, query: nil, splode: Ash.Error, changeset: %{atomics: [], handle_errors: nil, atomic_validations: [], to_tenant: nil, relationships: %{}, around_action: [], attributes: %{id: "1594fa3e-0264-4c1e-9bf2-4e81c429187d", title: "질문 3 제목11", body: "질문 3 내용", created_at: ~U[2024-04-30 02:42:55.105383Z], updated_at: ~U[2024-04-30 02:42:55.105383Z], question_answer_post_category_id: 3, pre_diary_id: "190a53a7-cb2f-4a11-aee4-82c9a37000ba", post_diary_id: "190a53a7-cb2f-4a11-aee4-82c9a37000ba", count_of_view: 0}, before_transaction: [], attribute_changes: %{id: "1594fa3e-0264-4c1e-9bf2-4e81c429187d", created_at: ~U[2024-04-30 02:42:55.105383Z], updated_at: ~U[2024-04-30 02:42:55.105383Z], count_of_view: 0}, invalid_keys: MapSet.new([]), timeout: nil, load: [], domain: Dentallog.QuestionAnswer, params: %{title: "질문 3 제목11", body: "질문 3 내용", question_answer_post_category_id: 3, pre_diary_id: "190a53a7-cb2f-4a11-aee4-82c9a37000ba", post_diary_id: "190a53a7-cb2f-4a11-aee4-82c9a37000ba"}, action_failed?: false, resource: Dentallog.QuestionAnswer.QuestionPost, filter: nil, arguments: %{}, action: %{error_handler: nil, name: :create, type: :create, accept: [:title, :body, :question_answer_post_category_id, :pre_diary_id, :post_diary_id], description: nil, manual: nil, metadata: [], arguments: [%{default: nil, name: :photos, type: {:array, Ash.Type.Map}, description: nil, __struct__: Ash.Resource.Actions.Argument, constraints: [items: [], empty_values: [""], nil_items?: false], allow_nil?: true, public?: true, sensitive?: false}], __struct__: Ash.Resource.Actions.Create, reject: [], upsert_identity: nil, upsert_fields: nil, upsert?: false, notifiers: [], changes: [%{on: nil, description: nil, where: [], __struct__: Ash.Resource.Change, always_atomic?: false, ...}, %{on: nil, description: nil, where: [], __struct__: Ash.Resource.Change, ...}], allow_nil_input: [], delay_global_validations?: false, primary?: false, require_attributes: [], skip_global_validations?: false, touches_resources: [], ...}, __struct__: Ash.Changeset, valid?: false, context: %{private: %{actor: %{id: "6e459d2b-bde9-4271-9bfa-2667bec08e48", __struct__: Dentallog.Accounts.User, token: %{type: :relationship, __struct__: Ash.NotLoaded, field: :token}, email: %{string: "exam23269522809745@gmail.com", case: nil, __struct__: Ash.CiString, casted?: false}, nickname: "example", phone_number: "010-1234-5678", calculations: %{}, aggregates: %{}, archived_at: nil, __lateral_join_source__: nil, __metadata__: %{token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ-PiA0LjAiLCJleHAiOjE3NDU5ODA5NzUsImlhdCI6MTcxNDQ0NDk3NSwiaXNzIjoiQXNoQXV0aGVudGljYXRpb24gdjQuMC4wIiwianRpIjoiMnY1ZXQ3b2VvbmIyMGplaGhjMDAwMmsxIiwibmJmIjoxNzE0NDQ0OTc1LCJwdXJwb3NlIjoidXNlciIsInN1YiI6InVzZXI_aWQ9NmU0NTlkMmItYmRlOS00MjcxLTliZmEtMjY2N2JlYzA4ZTQ4In0.ZEg3TOLGIV_CjnKb4Ah9r0WDJNzcVmKf74wCvnLHtQ4", confirmation_token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY3QiOiJjb25maXJtIiwiYXVkIjoifj4gNC4wIiwiZXhwIjoxNzE0NzA0MTc1LCJpYXQiOjE3MTQ0NDQ5NzUsImlzcyI6IkFzaEF1dGhlbnRpY2F0aW9uIHY0LjAuMCIsImp0aSI6IjJ2NWV0N29mZnJ2bmdqZWhoYzAwMDJsMSIsIm5iZiI6MTcxNDQ0NDk3NSwic3ViIjoidXNlcj9pZD02ZTQ1OWQyYi1iZGU5LTQyNzEtOWJmYS0yNjY3YmVjMDhlNDgifQ.APY7zAivW077zInt3qbnXYsh-Dqf5x3xD_xwBN17PzY"}, __order__: nil, confirmed_at: nil, created_at: ~U[2024-04-30 02:42:54.788476Z], doctor_hospital_name: nil, doctor_name: nil, ...}, authorize?: true, upsert_identity: nil, upsert_fields: nil, upsert?: true}, actor: %{id: "6e459d2b-bde9-4271-9bfa-2667bec08e48", __struct__: Dentallog.Accounts.User, token: %{type: :relationship, __struct__: Ash.NotLoaded, field: :token}, email: %{string: "exam23269522809745@gmail.com", case: nil, __struct__: Ash.CiString, casted?: false}, nickname: "example", phone_number: "010-1234-5678", calculations: %{}, aggregates: %{}, archived_at: nil, __lateral_join_source__: nil, __metadata__: %{token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ-PiA0LjAiLCJleHAiOjE3NDU5ODA5NzUsImlhdCI6MTcxNDQ0NDk3NSwiaXNzIjoiQXNoQXV0aGVudGljYXRpb24gdjQuMC4wIiwianRpIjoiMnY1ZXQ3b2VvbmIyMGplaGhjMDAwMmsxIiwibmJmIjoxNzE0NDQ0OTc1LCJwdXJwb3NlIjoidXNlciIsInN1YiI6InVzZXI_aWQ9NmU0NTlkMmItYmRlOS00MjcxLTliZmEtMjY2N2JlYzA4ZTQ4In0.ZEg3TOLGIV_CjnKb4Ah9r0WDJNzcVmKf74wCvnLHtQ4", confirmation_token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY3QiOiJjb25maXJtIiwiYXVkIjoifj4gNC4wIiwiZXhwIjoxNzE0NzA0MTc1LCJpYXQiOjE3MTQ0NDQ5NzUsImlzcyI6IkFzaEF1dGhlbnRpY2F0aW9uIHY0LjAuMCIsImp0aSI6IjJ2NWV0N29mZnJ2bmdqZWhoYzAwMDJsMSIsIm5iZiI6MTcxNDQ0NDk3NSwic3ViIjoidXNlcj9pZD02ZTQ1OWQyYi1iZGU5LTQyNzEtOWJmYS0yNjY3YmVjMDhlNDgifQ.APY7zAivW077zInt3qbnXYsh-Dqf5x3xD_xwBN17PzY"}, __order__: nil, confirmed_at: nil, created_at: ~U[2024-04-30 02:42:54.788476Z], doctor_hospital_name: nil, doctor_name: nil, ...}, authorize?: true}, casted_attributes: %{title: "질문 3 제목11", body: "질문 3 내용", question_answer_post_category_id: 3, pre_diary_id: "190a53a7-cb2f-4a11-aee4-82c9a37000ba", post_diary_id: "190a53a7-cb2f-4a11-aee4-82c9a37000ba"}, before_action: [], data: %{id: nil, user: %{type: :relationship, __struct__: Ash.NotLoaded, field: :user}, title: nil, __struct__: Dentallog.QuestionAnswer.QuestionPost, body: nil, comments: %{type: :relationship, __struct__: Ash.NotLoaded, field: :comments}, calculations: %{}, aggregates: %{}, archived_at: nil, __lateral_join_source__: nil, __metadata__: %{}, __order__: nil, created_at: nil, updated_at: nil, paper_trail_versions: %{...}, ...}, phase: :pending, casted_arguments: %{}, after_action: [#Function<5.11754845/2 in AshPaperTrail.Resource.Changes.CreateNewVersion>], __validated_for_action__: :create, defaults: [:updated_at, :created_at, :id, :count_of_view], tenant: nil, select: nil, errors: [%{message: "relationship is not editable", path: [], stacktrace: %{stacktrace: [{Process, ...}, {...}, ...], __struct__: Splode.Stacktrace}, __struct__: Ash.Error.Changes.InvalidRelationship, vars: [], __exception__: true, ...}], after_transaction: [], around_transaction: [], action_type: :create}, action_input: nil, bread_crumbs: []})
(elixir 1.15.7) lib/exception.ex:63: Exception.message/1
(elixir 1.15.7) lib/exception.ex:114: Exception.format_banner/3
lib/livebook/runtime/evaluator/formatter.ex:128: Livebook.Runtime.Evaluator.Formatter.format_error/3
lib/livebook/runtime/evaluator/formatter.ex:46: Livebook.Runtime.Evaluator.Formatter.format_result/2
lib/livebook/runtime/evaluator.ex:469: Livebook.Runtime.Evaluator.continue_do_evaluate_code/6
lib/livebook/runtime/evaluator.ex:331: Livebook.Runtime.Evaluator.loop/1
(stdlib 5.1.1) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
(elixir 1.15.7) lib/process.ex:860: Process.info/2
lib/ash/error/invalid.ex:5: Ash.Error.Invalid.exception/1
/Users/dwlee/Documents/dentallog/dentallog-server/deps/splode/lib/splode.ex:211: Ash.Error.to_class/2
lib/ash/error/error.ex:33: Ash.Error.to_error_class/2
lib/ash/actions/create/create.ex:131: Ash.Actions.Create.do_run/4
lib/ash/actions/create/create.ex:46: Ash.Actions.Create.run/4
lib/ash.ex:1965: Ash.create!/2
#cell:kt7wpam7ybjrxk6dqjesfulxdsrk3lio:5: (file)
Probably the main cause is coming from the relationship, but I’m wondering what I can do to fix it.