Please help … I know this must be a stupid mistake, but the error I’m getting has nothing to do with the root problem. Probably. Maybe.
error: undefined function use/3 (there is no such import)
lib/boss_site/walk/resources/activity.ex:11: BossSite.Walk.Activity (module)
== Compilation error in file lib/boss_site/walk/resources/activity.ex ==
** (CompileError) lib/boss_site/walk/resources/activity.ex: cannot compile module BossSite.Walk.Activity (errors have been logged)
The code it’s pointing at:
defmodule BossSite.Walk.Activity do
use Ash.Resource, # << – error points here
data_layer: AshPostgres.DataLayer
do postgres
table "activities"
repo BossSite.Repo
end
...
I’m thinking it must be something like an incompatible version dependency or…?
# mix.exs // deps
defp deps do
[
{:phoenix, "~> 1.7"},
{:phoenix_ecto, "~> 4.4"},
{:ecto_sql, "~> 3.11"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 3.3"},
{:phoenix_live_reload, "~> 1.4", only: :dev},
{:phoenix_live_view, "~> 0.2"},
{:floki, ">= 0.35.0", only: :test},
{:phoenix_live_dashboard, "~> 0.8"},
{:esbuild, "~> 0.5", runtime: Mix.env() == :dev},
{:tailwind, "~> 0.2", runtime: Mix.env() == :dev},
{:swoosh, "~> 1.14"},
{:finch, "~> 0.16"},
{:telemetry_metrics, "~> 0.6"},
{:telemetry_poller, "~> 1.0"},
{:gettext, "~> 0.24"},
{:jason, "~> 1.4"},
{:plug_cowboy, "~> 2.6"},
# My stuff - some supporting dependencies I really like:
{:mix_test_interactive, "~> 1.2", only: :dev, runtime: false}, # mix test.interactive package
{:dialyxir, "~> 1.3", only: [:dev], runtime: false}, # catch the naughty stuff
{:lettuce, "~> 0.3", only: :dev}, # background iex recompile package (see config: for proper setup!)
{:credo, "~> 1.7", only: [:dev, :test], runtime: false}, # catch more naughty stuff
{:propcheck, "~> 1.4", only: [:test, :dev]}, # property based testing and generator magiks
# My stuff - dependencies and frameworks this project uses:application
{:ash, "~> 2.17"},
{:ash_postgres, "~> 1.3"},
{:ash_phoenix, "~> 1.2"},
]
end
Relevant config.exs
:
import Config
config :boss_site,
ecto_repos: [BossSite.Repo]
config :boss_site,
:ash_apis, [BossSite.Walk]
This is an early iteration, with 3 resources. It was working fine using ETS. Now I’m trying to upgrade it to “real” persistence with Postgres. I’ve been through the Ash Postgres tutorials a dozen times looking for something out of place, and just can’t find it.