agonzalezro
Hi ![]()
I am trying to seed some data on my DB but I am getting an undefined error to a function that I am not directly calling.
This is the code of my priv/repo/seed.exs file:
alias Ash.Seed
_users =
["a@example", "b@example.com"]
|> Enum.each(fn email ->
Seed.upsert!(
%Mcduck.Accounts.User{
email: email
},
identity: :unique_email
)
end)
_rates =
[
["EUR", "CHF", 0.93],
["CHF", "EUR", 1.083]
]
|> Enum.each(fn [base_currency, target_currency, rate] ->
Seed.seed!(%Mcduck.Money.Rates{
base_currency: base_currency,
target_currency: target_currency,
rate: rate
})
end)
And this is the error when I run it with mix run priv/repo/seed.exs:
** (UndefinedFunctionError) function AshPostgres.DataLayer.upsert/3 is undefined or private. Did you mean:
* upsert/4
(ash_postgres 2.5.16) AshPostgres.DataLayer.upsert(Mcduck.Accounts.User, #Ash.Changeset<action_type: :create, action: nil, attributes: %{created_at: ~U[2025-04-17 08:56:02.046018Z], email: #Ash.CiString<"a@example.com">, id: "ec7864ae-43bc-450f-a52c-1df784c1ed42", updated_at: ~U[2025-04-17 08:56:02.046018Z]}, relationships: %{}, errors: [], data: #Mcduck.Accounts.User<__meta__: #Ecto.Schema.Metadata<:built, "users">, id: nil, email: nil, created_at: nil, updated_at: nil, aggregates: %{}, calculations: %{}, ...>, context: %{changed?: true}, valid?: true>, [:email])
(ash 3.5.6) lib/ash/changeset/changeset.ex:4161: Ash.Changeset.run_around_actions/2
(ash 3.5.6) lib/ash/changeset/changeset.ex:3839: anonymous fn/2 in Ash.Changeset.transaction_hooks/2
(ash 3.5.6) lib/ash/changeset/changeset.ex:3749: Ash.Changeset.with_hooks/3
(ash 3.5.6) lib/ash/seed.ex:289: Ash.Seed.upsert!/3
(elixir 1.17.3) lib/enum.ex:987: Enum."-each/2-lists^foreach/1-0-"/2
priv/repo/seeds.exs:17: (file)
(elixir 1.17.3) lib/code.ex:1491: Code.require_file/2
(mix 1.17.3) lib/mix/tasks/run.ex:146: Mix.Tasks.Run.run/5
(mix 1.17.3) lib/mix/tasks/run.ex:85: Mix.Tasks.Run.run/1
(mix 1.17.3) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5
(mix 1.17.3) lib/mix/cli.ex:96: Mix.CLI.run_task/2
/etc/profiles/per-user/alex/bin/mix:2: (file)
I have updated to the latest versions of the dependencies including ash & ash_postgres.
A weird thing is that it worked at times just once when I updated just ash_postgres. Maybe it’s some cache somewhere trying to use a wrong function? I tried a mix clean and also:
❯ mix ash_postgres.drop && mix ash_postgres.create && mix ash_postgres.migrate && mix deps.update ash_postgres --force && mix run priv/repo/seeds.exs
Thanks!
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
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
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
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 there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
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
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex










Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
zachdaniel
Yes, it looks like we need to be using
Code.ensure_loaded?(data_layer)before checking if functions are exported on it.zachdaniel
Fixed in
main.agonzalezro
Great! Thanks for fixing it and doing it so quickly
agonzalezro
FTR in case that it helps anybody arriving here.
I am fixing it adding this prefix to the seeds file: