Ash FrameworkAF
Ash Framework6mo ago
9 replies
Ben

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


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


In application.ex, I have the following Oban config:
      {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

  oban do
    domain App.Compliance


and see if that works, but that shouldn't be necessary anymore since Ash 3.0
Was this page helpful?