ArgumentError When Using Generic Action In scheduled_actions

When I try to create a scheduled_actions - schedule in a Resource I get the following error:

15:32:00.625 [error] GenServer {Oban.Registry, {Oban, {:plugin, Oban.Plugins.Cron}}} terminating
** (ArgumentError) comparing `field(j, ^field)` with `nil` is forbidden as it is unsafe. If you want to check if a value is nil, use is_nil/1 instead
    (ecto 3.13.3) lib/ecto/query/builder.ex:1265: Ecto.Query.Builder.not_nil!/2
    (oban 2.20.1) lib/oban/engines/basic.ex:511: anonymous fn/4 in Oban.Engines.Basic.unique_field/2
    (ecto 3.13.3) lib/ecto/query/builder/dynamic.ex:83: Ecto.Query.Builder.Dynamic.expand/3
    (stdlib 7.1) lists.erl:2673: :lists.mapfoldl_1/3
    (stdlib 7.1) lists.erl:2674: :lists.mapfoldl_1/3
    (elixir 1.18.4) lib/macro.ex:610: Macro.do_traverse/4
    (ecto 3.13.3) lib/ecto/query/builder/dynamic.ex:53: Ecto.Query.Builder.Dynamic.fully_expand/2
    (ecto 3.13.3) lib/ecto/query/builder/filter.ex:133: Ecto.Query.Builder.Filter.filter!/7
Last message: :evaluate
State: %Oban.Plugins.Cron{conf: %Oban.Config{dispatch_cooldown: 5, engine: Oban.Engines.Basic, get_dynamic_repo: nil, insert_trigger: true, log: false, name: Oban, node: "nixos", notifier: {Oban.Notifiers.Postgres, []}, peer: {Oban.Peers.Database, []}, plugins: [{Oban.Plugins.Cron, [crontab: [{"* * * * *", Helpdesk.Support.Ticket.TestActionWorker, []}]]}], prefix: "public", queues: [default: [limit: 10], ticket_test_action: [limit: 10]], repo: Helpdesk.Repo, shutdown_grace_period: 15000, stage_interval: 1000, testing: :disabled}, timer: #Reference<0.4199275419.3126067205.218179>, crontab: [{"* * * * *", #Oban.Cron.Expression<input: "* * * * *", ...>, Helpdesk.Support.Ticket.TestActionWorker, []}], timezone: "Etc/UTC"}

The simplest reproduction that I can make that throws the error is as follows:

defmodule Helpdesk.Support.Ticket do
  use Ash.Resource,
    otp_app: :helpdesk,
    domain: Helpdesk.Support,
    extensions: [AshOban]

  oban do
    domain Helpdesk.Support

    scheduled_actions do
      schedule :test_action, "* * * * *" do
        worker_module_name Helpdesk.Support.Ticket.AshOban.ActionWorker.TestAction
      end
    end
  end

  actions do
    action :test_action do
      run fn _input, _ ->
        IO.inspect("Ran the text action")
        :ok
      end
    end
  end
end

I’ve tried using the main branch in ash_oban from Github and I still get the same error.

:thinking: I’m not sure if this is something underlying in Oban or on our end…more likely to be us than them. Could you please create a reproduction repository and open an issue on AshOban?

For sure!

I created a Minimal Reproduction
I created a Github Issue in the ash_oban project

Thanks for your time!