Invalid association, not an ecto schema

I'm getting a strange compile error that I can't replicate locally, only in GitHub Actions, I'm on the latest version of everything, ash deps, elixir and erlang.
==> spendable
Compiling 5 files (.ex)
warning: invalid association `budget` in schema Spendable.BudgetAllocation: associated module Spendable.Budget is not an Ecto schema
Warning: lib/spendable/resources/budget_allocation.ex:1
==> spendable
Compiling 5 files (.ex)
warning: invalid association `budget` in schema Spendable.BudgetAllocation: associated module Spendable.Budget is not an Ecto schema
Warning: lib/spendable/resources/budget_allocation.ex:1
I'm not sure what would be different in GitHub Actions to cause this, any ideas where to look?
15 Replies
ZachDaniel
ZachDaniel2y ago
My guess would be that it’s an elixir version thing What version are you on in CI vs locally?
michaelst
michaelstOP2y ago
Both 1.15.2, I noticed it is also happening in docker builds
ZachDaniel
ZachDaniel2y ago
🤔🤔🤔what about OTP version?
michaelst
michaelstOP2y ago
26.0.2, also same on both
ZachDaniel
ZachDaniel2y ago
Strange Still can’t reproduce it locally? What if you blow away your build directory locally and recompile?
michaelst
michaelstOP2y ago
yep still not happening locally, but even then the error doesn't make any sense, what would trigger that
ZachDaniel
ZachDaniel2y ago
It would be some kind of compilation order/dependency issue (not a mix dependency but module compilation dependency) The ecto schema we build under the hood doesn't think the other resources we add as associations are also ecto schemas for some reason
michaelst
michaelstOP2y ago
in case you want to play with it this project is open source https://github.com/michaelst/spendable, seems to be happening consistently in the tests in CI actually whatever changes I have made in my uuid migration got rid of it...
Blibs
Blibs2y ago
I'm having the exact same problem and I can't figure out a solution for it. @michaelst can you elaborate more on what you changed?
michaelst
michaelstOP2y ago
The error actually came back, I think it is the order like Zach was mentioning
ZachDaniel
ZachDaniel2y ago
I should have fixed it on latest ash
Blibs
Blibs2y ago
I'm not in the latest version, I will try updating it and see if that works Yep, updating to the latest version fixed it, thanks @Zach Daniel ! @michaelst probably doing the same will fix it for you as-well
michaelst
michaelstOP2y ago
Thanks!
\ ឵឵឵
\ ឵឵឵2y ago
GitHub
Resources defined within other resources issue Ecto warnings · Issu...
When creating a subresource using an extension, the compiler issues the following warning: warning: invalid association post in schema App.Post.Comment: associated module App.Post is not an Ecto ...
ZachDaniel
ZachDaniel2y ago
good call, thats fixed now

Did you find this page helpful?