Error when using before_action hook to set required relationship attribute
I'm using a before action to lookup and set the
:state_id
by the state's name or code.
However, the change doesn't seem to be running as I never see the Logger.debugs and I get changeset errors that :state_id
is required.
Have I misconfigured this hook?
Action
Change Module
Solution:Jump to solution
Reproduction added to https://github.com/ash-project/ash/issues/2170
GitHub
Error when using before_action hook to set required relationship at...
Versions erlang 27.3.4.1 elixir 1.18.4 ash 3.5.12 ash_postgres 2.5.22 ecto 3.12.5 ecto_sql 3.12.1 Originally found and reported in Discord Support on 6/16/2025 and tried upgrading the latest versio...
13 Replies
🤔 have you tried removing the condition?
Like the
where
?
That would tell you if its an issue w/ the predicate or notI did, but let me try again real quick
yeah, same thing
🤔 how are you calling it?
through the code_interface as a bulk action
You're on the latest version of everything?
We had a bug around this that we fixed
I just ran igniter.upgrade. Let me blow away _build and deps to see if that helps
check w/
mix hex.outdated
too just in case
unless you're on branches then
I think we have an open issue about this I'm not sure if igniter.upgrade
does git dependencies
Try mix deps.update
everything is already up to date. Still happens after reinstalling everything
I'm using all hex versions
😢
the only other config I have for the upsert is this. Maybe an issue?
saying not to replace state_id?
It is probably a bug.
Can you push a test to your app?
or make a repro?
yeah, I'll open an issue and see if I can do a repro
I using a work around with a no attributes relationship for now. Have a hard deadline to get some new features out by tomorrow night. Once I get that done, I’ll create an issue and look into the root cause.
I added an issue in the
ash
repo for tracking. Still haven't had a chance to make a reproduction, but will add it to the issue when I can.Solution
Reproduction added to https://github.com/ash-project/ash/issues/2170
GitHub
Error when using before_action hook to set required relationship at...
Versions erlang 27.3.4.1 elixir 1.18.4 ash 3.5.12 ash_postgres 2.5.22 ecto 3.12.5 ecto_sql 3.12.1 Originally found and reported in Discord Support on 6/16/2025 and tried upgrading the latest versio...