Elixir custom plugin can't load Application

Hello , I created a custom Hex plugin which has a application.ex file, but after installing this into my project, when I run phoenix started command, it shows me this error:

** (Mix) Could not start application mishka_auth: exited in: MishkaAuth.Application.start(:normal, [])
    ** (EXIT) an exception was raised:
        ** (ArgumentError) could not fetch application environment MishkaAuth for application :mishka_auth because configuration at MishkaAuth was not set
            (elixir 1.10.2) lib/application.ex:653: Application.fetch_env!/2
            (mishka_auth 0.0.1) lib/mishka_auth.ex:11: MishkaAuth.get_config_info/1
            (mishka_auth 0.0.1) lib/mishka_auth/application.ex:10: MishkaAuth.Application.start/2
            (kernel 6.5.1) application_master.erl:277: :application_master.start_it_old/4

repo: https://github.com/shahryarjb/mishka-auth

Thanks

It looks like error comes from Application.fetch_env!(:mishka_auth, MishkaAuth).

I’m just Elixir beginner and I don’t understand MishkaAuth there, but you don’t define any keys under :mishka_auth so this is clearly an error regardless of what value is used as second parameter.

mix.exs doesn’t define any environment values at all, and config/* files only define values under :phoenix and :logger, and nothing under :mishka_auth.

2 Likes

Thanks, I made a small mistake after your help I fix my config file and change config :mishka_auth, MishkaAuth, .

thanks