I'm trying to start a child process in Elixir, and am receiving the following error:
{:error, {:invalid_mfa, {Worker, :start_link, "MY_TEAM_ID"}}}
My supervisor code looks something like this:
DynamicSupervisor.start_child(Worker.Supervisor, {Worker, "MY_TEAM_ID"})
From the error message, the child_spec is supposed to pass its arguments as a list. Instead it should be {:error, {:invalid_mfa, {Worker, :start_link, ["MY_TEAM_ID"]}}} (note the [] around the params)
Inside your Worker module, check your child_spec function. It should look something like this (again, note the [] around team_id):
def child_spec(team_id) do
%{
id: __MODULE__,
start: {__MODULE__, :start_link, [team_id]},
type: :worker
}
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With