start_child returning error undef with a DynamicSupervisor

49 Views Asked by At
{:error,
 {:undef,
  [
    {MobSchema, :new, [%{}], []},
    {Rotb.Mobs.Mob, :start_link, 1, [file: ~c"lib/rotb/mobs/mob.ex", line: 8]},
    {DynamicSupervisor, :start_child, 3,
     [file: ~c"lib/dynamic_supervisor.ex", line: 795]},
    {DynamicSupervisor, :handle_start_child, 2,
     [file: ~c"lib/dynamic_supervisor.ex", line: 781]},
    {:gen_server, :try_handle_call, 4, [file: ~c"gen_server.erl", line: 1113]},
    {:gen_server, :handle_msg, 6, [file: ~c"gen_server.erl", line: 1142]},
    {:proc_lib, :init_p_do_apply, 3, [file: ~c"proc_lib.erl", line: 241]}
  ]}}

Calling the following functin with a map of properties %{}

  def start_mob(opts) do
    child_spec = Rotb.Mobs.Mob.child_spec(opts) 

    DynamicSupervisor.start_child(__MODULE__, child_spec) |> IO.inspect()
  end

I'm not even sure what other code to share. The child is a GenServer with all the usual GenServer callbacks and via tuple with registry. I've written similar code and it worked.

0

There are 0 best solutions below