samsondav/rihanna

Bug: Can't start Rihanna supervisor on Elixir 1.5

barisbalic opened this issue · 2 comments

I've been running an Elixir app on Heroku, once I introduced Rihanna it began crashing on startup. Upgrading to Elixir 1.6 remedies the problem but the docs state 1.5 should work so I'm reporting the stack traces here.

Adding the supervisor as described...

supervisor(Rihanna.Supervisor, [name: Rihanna.Supervisor, postgrex: My.Repo.config()])

Results in...

Application archie exited: Archie.Application.start(:normal, []) returned an error: shutdown: failed to start child: Rihanna.Supervisor
** (EXIT) an exception was raised:
** (FunctionClauseError) no function clause matching in Keyword.pop_first/3
(elixir) lib/keyword.ex:959: Keyword.pop_first({:name, Rihanna.Supervisor}, :postgrex, [])
(rihanna) lib/rihanna/supervisor.ex:32: Rihanna.Supervisor.start_link/2
(stdlib) supervisor.erl:365: :supervisor.do_start_child/2
(stdlib) supervisor.erl:348: :supervisor.start_children/3
(stdlib) supervisor.erl:314: :supervisor.init_children/2
(stdlib) gen_server.erl:328: :gen_server.init_it/6
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
{"Kernel pid terminated",application_controller,"{application_start_failure,archie,{{shutdown,{failed_to_start_child,'Elixir.Rihanna.Supervisor',{'EXIT',{function_clause,[{'Elixir.Keyword',pop_first,[{name,'Elixir.Rihanna.Supervisor'},postgrex,[]],[{file,\"lib/keyword.ex\"},{line,959}]},{'Elixir.Rihanna.Supervisor',start_link,2,[{file,\"lib/rihanna/supervisor.ex\"},{line,32}]},{supervisor,do_start_child,2,[{file,\"supervisor.erl\"},{line,365}]},{supervisor,start_children,3,[{file,\"supervisor.erl\"},{line,348}]},{supervisor,init_children,2,[{file,\"supervisor.erl\"},{line,314}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,328}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,247}]}]}}}},{'Elixir.Archie.Application',start,[normal,[]]}}}"}

Hey Baris, thanks for opening a bug.

I have changed the README so it now has the correct way to do this - see fe1e08e

Please let me know if this fixes your problem

@samphilipd good catch, it works fine now.