edgurgel / verk

A job processing system that just verks! 🧛‍
https://hex.pm/packages/verk
MIT License
721 stars 65 forks source link

function Verk.Supervisor.start_link/1 is undefined or private #179

Closed robinvdvleuten closed 5 years ago

robinvdvleuten commented 5 years ago

I am trying to add Verk to my supervised processes in a Phoenix 1.4 application;

children = [
      MyApp.Repo,
      MyAppWeb.Endpoint,
      Verk.Supervisor
]

But whenever I start my application, I receive the following error;

** (Mix) Could not start application submit: MyApp.Application.start(:normal, []) returned an error: shutdown: failed to start child: Verk.Supervisor
    ** (EXIT) an exception was raised:
        ** (UndefinedFunctionError) function Verk.Supervisor.start_link/1 is undefined or private
edgurgel commented 5 years ago

Could you please check which version of Verk is defined inside your mix.lock? It should be defined if it's loaded 🤔

robinvdvleuten commented 5 years ago

Sure, that's the latest version (1.4.1). After investigating further, the problem is that the functions is defined as Verk.Supervisor.start_link/0 within Verk (https://github.com/edgurgel/verk/blob/master/lib/verk/supervisor.ex#L15). But that Phoenix / Supervisor expect it to be defined as Verk.Supervisor.start_link/1.

When changing the start_link method to something like;

def start_link(opts \\ []) do
  Supervisor.start_link(__MODULE__, opts, name: __MODULE__)
end

the issue seems to be solved solved.

edgurgel commented 5 years ago

Fixed by https://github.com/edgurgel/verk/commit/51250f78f01d1803a7263e93de7c483a1d1d3579