AshOban - no configuration for `domain`

I'm trying to get a scan to run on a cron schedule with Oban, but I'm having some trouble configuring it. This is my Oban configuration in the resource:
defmodule App.Compliance.ScanConfiguration do
use Ash.Resource,
otp_app: :app,
domain: App.Compliance,
data_layer: AshPostgres.DataLayer,
extensions: [AshOban]

oban do
scheduled_actions do
schedule :run_scan, "*/5 * * * *",
action: :run_scan,
worker_module_name: AshOban.Test.Triggered.AshOban.ActionWorker.SayHello
end
end
defmodule App.Compliance.ScanConfiguration do
use Ash.Resource,
otp_app: :app,
domain: App.Compliance,
data_layer: AshPostgres.DataLayer,
extensions: [AshOban]

oban do
scheduled_actions do
schedule :run_scan, "*/5 * * * *",
action: :run_scan,
worker_module_name: AshOban.Test.Triggered.AshOban.ActionWorker.SayHello
end
end
However, it complains when I try to compile (or run anything):
== Compilation error in file lib/app/compliance/scan_configuration.ex ==
** (RuntimeError) Exception in transformer AshOban.Transformers.DefineActionWorkers on App.Compliance.ScanConfiguration:

No configuration for `domain` present on App.Compliance.ScanConfiguration
== Compilation error in file lib/app/compliance/scan_configuration.ex ==
** (RuntimeError) Exception in transformer AshOban.Transformers.DefineActionWorkers on App.Compliance.ScanConfiguration:

No configuration for `domain` present on App.Compliance.ScanConfiguration
In application.ex, I have the following Oban config:
{Oban,
AshOban.config(
Application.fetch_env!(:app, :ash_domains),
Application.fetch_env!(:app, Oban)
)},
{Oban,
AshOban.config(
Application.fetch_env!(:app, :ash_domains),
Application.fetch_env!(:app, Oban)
)},
Did I miss anything? How could I further debug this? If, alternatively, I should try to solve this in a different way entirely I'm all ears as well! (Oban triggers?)
Solution:
you can tray and add ```elixir oban do...
Jump to solution
6 Replies
Solution
barnabasj
barnabasj2mo ago
you can tray and add
oban do
domain App.Compliance
oban do
domain App.Compliance
and see if that works, but that shouldn't be necessary anymore since Ash 3.0
Ben
BenOP2mo ago
Thanks! That did get rid of this particular error, on to the next one: Must configure the queue :scan_configuration_run_scan
barnabasj
barnabasj2mo ago
what version of the libraries are you on? tha'ts just standard oban, in the config.exs file
Ben
BenOP2mo ago
{:bcrypt_elixir, "~> 3.0"},
{:picosat_elixir, "~> 0.2"},
{:sourceror, "~> 1.8", only: [:dev, :test]},
{:oban, "~> 2.0"},
{:open_api_spex, "~> 3.0"},
{:ash_cloak, "~> 0.1"},
{:cloak, "~> 1.0"},
{:ash_paper_trail, "~> 0.5"},
{:live_debugger, "~> 0.3", only: [:dev]},
{:oban_web, "~> 2.0"},
{:ash_oban, "~> 0.4"},
{:ash_admin, "~> 0.13"},
{:ash_authentication_phoenix, "~> 2.0"},
{:ash_authentication, "~> 4.0"},
{:ash_postgres, "~> 2.0"},
{:ash_json_api, "~> 1.0"},
{:ash_phoenix, "~> 2.0"},
{:ash, "~> 3.0"},
{:igniter, "~> 0.6", only: [:dev, :test]},
{:phoenix, "~> 1.8.0-rc.4", override: true},
{:phoenix_ecto, "~> 4.5"},
{:ecto_sql, "~> 3.13"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 4.1"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:phoenix_live_view, "~> 1.1.0-rc.0"},
{:lazy_html, ">= 0.1.0", only: :test},
{:phoenix_live_dashboard, "~> 0.8.3"},
{:esbuild, "~> 0.10", runtime: Mix.env() == :dev},
{:tailwind, "~> 0.3", runtime: Mix.env() == :dev},
{:heroicons,
github: "tailwindlabs/heroicons",
tag: "v2.2.0",
sparse: "optimized",
app: false,
compile: false,
depth: 1},
{:swoosh, "~> 1.16"},
{:req, "~> 0.5"},
{:telemetry_metrics, "~> 1.0"},
{:telemetry_poller, "~> 1.0"},
{:gettext, "~> 0.26"},
{:jason, "~> 1.2"},
{:dns_cluster, "~> 0.2.0"},
{:bandit, "~> 1.5"},
{:bcrypt_elixir, "~> 3.0"},
{:picosat_elixir, "~> 0.2"},
{:sourceror, "~> 1.8", only: [:dev, :test]},
{:oban, "~> 2.0"},
{:open_api_spex, "~> 3.0"},
{:ash_cloak, "~> 0.1"},
{:cloak, "~> 1.0"},
{:ash_paper_trail, "~> 0.5"},
{:live_debugger, "~> 0.3", only: [:dev]},
{:oban_web, "~> 2.0"},
{:ash_oban, "~> 0.4"},
{:ash_admin, "~> 0.13"},
{:ash_authentication_phoenix, "~> 2.0"},
{:ash_authentication, "~> 4.0"},
{:ash_postgres, "~> 2.0"},
{:ash_json_api, "~> 1.0"},
{:ash_phoenix, "~> 2.0"},
{:ash, "~> 3.0"},
{:igniter, "~> 0.6", only: [:dev, :test]},
{:phoenix, "~> 1.8.0-rc.4", override: true},
{:phoenix_ecto, "~> 4.5"},
{:ecto_sql, "~> 3.13"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 4.1"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:phoenix_live_view, "~> 1.1.0-rc.0"},
{:lazy_html, ">= 0.1.0", only: :test},
{:phoenix_live_dashboard, "~> 0.8.3"},
{:esbuild, "~> 0.10", runtime: Mix.env() == :dev},
{:tailwind, "~> 0.3", runtime: Mix.env() == :dev},
{:heroicons,
github: "tailwindlabs/heroicons",
tag: "v2.2.0",
sparse: "optimized",
app: false,
compile: false,
depth: 1},
{:swoosh, "~> 1.16"},
{:req, "~> 0.5"},
{:telemetry_metrics, "~> 1.0"},
{:telemetry_poller, "~> 1.0"},
{:gettext, "~> 0.26"},
{:jason, "~> 1.2"},
{:dns_cluster, "~> 0.2.0"},
{:bandit, "~> 1.5"},
barnabasj
barnabasj2mo ago
versions look good, I'll put it on my list to check why the domain config was needed, as it should just use the one you have on the resource
Ben
BenOP2mo ago
Fixed! Thanks a lot

Did you find this page helpful?