drikanius
Hi guys.
I have this module, and I’m just trying to create an update:
defmodule Marketplace.Ap.Appointment do
@moduledoc false
alias Marketplace.Ap
use Ash.Resource,
data_layer: AshPostgres.DataLayer
code_interface do
define_for Marketplace.Ap
define :create
define :update
define :get_by_lead
end
attributes do
uuid_primary_key :id
attribute :appt_type, :integer do
description "In-Home = 1, Virtual = 2"
end
attribute :appointment_time, :utc_datetime_usec
attribute :status, :string
attribute :name_assigned_to, :string
attribute :reschedule_uri, :string
attribute :cancel_uri, :string
attribute :cancel_reason, :string
attribute :cancel_notes, :string
attribute :cancel_by_type, :string
attribute :score, :integer, allow_nil?: false
timestamps()
end
relationships do
belongs_to :canceled_by, Ap.User
belongs_to :assigned_to, Ap.User
belongs_to :assigned_by, Ap.User do
primary_key? true
allow_nil? false
attribute_writable? true
end
belongs_to :lead, Ap.Lead do
attribute_writable? true
end
end
identities do
identity :unique_id, [:lead_id]
end
postgres do
table "appointment"
schema "dbo"
repo Marketplace.ApRepo
end
actions do
alias Marketplace.Ap.Actions.Appointment.Actions.Create
defaults [:read, :update]
create :create do
primary? true
accept [:score]
upsert? true
upsert_fields [:score, :updated_at, :appt_type]
upsert_identity :unique_id
argument :lead_id, :uuid, allow_nil?: false
argument :appt_type, :atom, allow_nil?: false
change Create.Changes.FixApptType
change set_attribute(:assigned_by_id, actor(:id))
change set_attribute(:lead_id, arg(:lead_id))
end
read :get_by_lead do
description "get appointment based on lead"
argument :lead_id, :uuid, allow_nil?: false
get? true
filter expr(lead_id == ^arg(:lead_id))
end
end
end
However, when I try to access using iex:
[appt] = Marketplace.Ap.Appointment |> Marketplace.Ap.read!
Marketplace.Ap.Appointment.update(appt, %{cancel_notes: "hi"})
I end up with this error:
** (Ash.Error.Unknown) Unknown Error
* ** (KeyError) key :__meta__ not found in: %Ash.Changeset.OriginalDataNotAvailable{reason: :atomic_query_update}
:erlang.map_get(:__meta__, %Ash.Changeset.OriginalDataNotAvailable{reason: :atomic_query_update})
(elixir 1.16.0) lib/map.ex:318: Map.update!/3
(ash_postgres 1.4.0) lib/data_layer.ex:1257: AshPostgres.DataLayer.update_query/4
(ash 2.18.1) lib/ash/actions/update/bulk.ex:278: Ash.Actions.Update.Bulk.do_atomic_update/4
(ash 2.18.1) lib/ash/actions/update/bulk.ex:120: Ash.Actions.Update.Bulk.run/5
(ash 2.18.1) lib/ash/actions/update/update.ex:81: Ash.Actions.Update.run/4
(marketplace 1.19.0) lib/marketplace/ap.ex:1: Marketplace.Ap.update/2
(stdlib 5.0.2) erl_eval.erl:746: :erl_eval.do_apply/7
(elixir 1.16.0) src/elixir.erl:378: :elixir.eval_forms/4
(elixir 1.16.0) lib/module/parallel_checker.ex:112: Module.ParallelChecker.verify/1
(iex 1.16.0) lib/iex/evaluator.ex:331: IEx.Evaluator.eval_and_inspect/3
(iex 1.16.0) lib/iex/evaluator.ex:305: IEx.Evaluator.eval_and_inspect_parsed/3
(iex 1.16.0) lib/iex/evaluator.ex:294: IEx.Evaluator.parse_eval_inspect/4
(iex 1.16.0) lib/iex/evaluator.ex:187: IEx.Evaluator.loop/1
(iex 1.16.0) lib/iex/evaluator.ex:32: IEx.Evaluator.init/5
(stdlib 5.0.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
:erlang.map_get(:__meta__, %Ash.Changeset.OriginalDataNotAvailable{reason: :atomic_query_update})
(elixir 1.16.0) lib/map.ex:318: Map.update!/3
(ash_postgres 1.4.0) lib/data_layer.ex:1257: AshPostgres.DataLayer.update_query/4
(ash 2.18.1) lib/ash/actions/update/bulk.ex:278: Ash.Actions.Update.Bulk.do_atomic_update/4
(ash 2.18.1) lib/ash/actions/update/bulk.ex:120: Ash.Actions.Update.Bulk.run/5
(ash 2.18.1) lib/ash/actions/update/update.ex:81: Ash.Actions.Update.run/4
(marketplace 1.19.0) lib/marketplace/ap.ex:1: Marketplace.Ap.update/2
Would anyone have any ideas on how to fix this?
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hello,
I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind.
However, when I launch mix phx.server, I get an error...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
So i have been using ash framework for a while and i love it. However currently the issue im having with ash framework is the error handl...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Latest Ash Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
zachdaniel
hello! I’m assuming you’re using
ashfrommainin that case. Can you also updateash_postgresto be frommainas well?drikanius
Actually I’m using both
ashandash_postgresfrommaindrikanius
I did some tests, and ended up realizing that all my updates for all resources are no longer working =/
They have different erros:
zachdaniel
Please try
mix deps.update ash ash_postgresdrikanius
After use
mix deps.update ash ash_postgresmy initial problem was solved. However I have other updates that give me those errors:I tried change to
{:ash, "~> 2.18", override: true}and{:ash_postgres, "~> 1.4"}.In this version update works fine. on master they dont.
If you prefer I can create a new topic
drikanius
First error I got it:
It seems that on master we must use
use Ash.Resource.Validation(before it worked without it, but it makes sense to be mandatory).But still have the second one
zachdaniel
Correct,
use Ash.Resource.Validationwill be necessary.I’m not familiar w/ that specific error, can you paste the full stacktrace/error message?
drikanius
This one?
Once again, on
{:ash, "~> 2.18", override: true}and{:ash_postgres, "~> 1.4"}, was working, now I got errorzachdaniel
Okay, try
ash_postgresmainagain please.mix deps.update ash_postgres. Lots of people work againstmainbranches, but just keep in mind that we’re gearing up for the 3.0 release, and are making some relatively significant changes inmain. Its starting to stabilize, just want to make sure you’re aware.drikanius
Still having the same error
Cool. I just added the version so you have the reference