oban-bg / oban

💎 Robust job processing in Elixir, backed by modern PostgreSQL and SQLite3
https://oban.pro
Apache License 2.0
3.28k stars 308 forks source link

Upgrading to Oban 2.17.4 from 2.17.3 fails compilation step with `no function clause matching in Ecto.Query.with_cte/3 ` #1041

Closed corroded closed 7 months ago

corroded commented 7 months ago

Precheck

Environment

Current Behavior

Upgrading to Oban 2.17.4 from 2.17.3 fails compilation step. To add, we are using Ecto 3.9.6.

==> oban
Compiling 56 files (.ex)

== Compilation error in file lib/oban/engines/basic.ex ==
** (FunctionClauseError) no function clause matching in Ecto.Query.with_cte/3    
    (ecto 3.9.6) expanding macro: Ecto.Query.with_cte/3
    lib/oban/engines/basic.ex:107: Oban.Engines.Basic.fetch_jobs/3
    (elixir 1.16.1) expanding macro: Kernel.|>/2
    lib/oban/engines/basic.ex:107: Oban.Engines.Basic.fetch_jobs/3
    (ecto 3.9.6) expanding macro: Ecto.Query.select/3
    lib/oban/engines/basic.ex:111: Oban.Engines.Basic.fetch_jobs/3
    (elixir 1.16.1) expanding macro: Kernel.|>/2
    lib/oban/engines/basic.ex:111: Oban.Engines.Basic.fetch_jobs/3
could not compile dependency :oban, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile oban --force", update it with "mix deps.update oban" or clean it with "mix deps.clean oban"

I looked into it and Ecto.Query.with_cte/3 actually exists in Ecto 3.9.6. The with_cte function was also recently changed in 2.17.4: https://github.com/sorentwo/oban/commit/02541e8e52941dac9d56c5b37170040c861e59dd

I admittedly have a limited knowledge of this specific command and function so I cannot debug further. Let me know if you need more info!

Expected Behavior

It should compile.

sorentwo commented 7 months ago

The materialized option used in Oban v2.17.4 wasn’t released until Ecto 3.10. Bumping up Ecto will fix the problem, and we’ll update Oban’s requirement.