Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oban bringing app down on Prod with error (expected :repo to implement Ecto.Repo, got: MyApp.Repo) #1006

Closed
nikhilbelchada opened this issue Dec 28, 2023 · 2 comments
Labels
area:oss Related to Oban OSS closed:invalid This doens't seem right kind:bug Something isn't working

Comments

@nikhilbelchada
Copy link

nikhilbelchada commented Dec 28, 2023

Application is encountering an error in prod environment during startup, leading to a crash. The error message suggests a problem with the initialization of the Oban application. Oban is working fine in dev environment

Application myapp exited: MyApp.Application.start(:normal, []) returned an error: shutdown: failed to start child: Oban
    ** (EXIT) an exception was raised:
        ** (ArgumentError) expected :repo to implement Ecto.Repo, got: MyApp.Repo
            (oban 2.17.1) lib/oban/config.ex:91: Oban.Config.new/1
            (oban 2.17.1) lib/oban.ex:387: Oban.start_link/1
            (stdlib 5.1.1) supervisor.erl:420: :supervisor.do_start_child_i/3
            (stdlib 5.1.1) supervisor.erl:406: :supervisor.do_start_child/2
            (stdlib 5.1.1) supervisor.erl:390: anonymous fn/3 in :supervisor.start_children/2
            (stdlib 5.1.1) supervisor.erl:1258: :supervisor.children_map/4
            (stdlib 5.1.1) supervisor.erl:350: :supervisor.init_children/2
            (stdlib 5.1.1) gen_server.erl:962: :gen_server.init_it/2

On futher investigating we found out that Oban uses __info__(:attributes) to check if repo implements Ecto.Repo behaviour and on prod when we ran MyApp.Repo.info(:attributes) it return empty list causing above error.

Not sure why __info__(:attributes) is returning empty list of attributes on prod environment.
Any help here will be appreciated

Environment

  • Oban Version: 2.17.1
  • PostgreSQL Version: 15.5
  • Elixir & Erlang/OTP Versions (elixir --version): Elixir 1.15.7 & Erlang/OTP 26
@sorentwo
Copy link
Member

@sorentwo sorentwo added kind:bug Something isn't working area:oss Related to Oban OSS closed:invalid This doens't seem right labels Dec 28, 2023
@sorentwo
Copy link
Member

As noted in the linked discussion, this was due to how nix built production releases and not from anything in Oban itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:oss Related to Oban OSS closed:invalid This doens't seem right kind:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants