Hi, I’m having troubles find out why the following error occures during startup:
You have configured application :ecto_gen in your configuration file,
but the application is not available.
This usually means one of:
1. You have not added the application as a dependency in a mix.exs file.
2. You are configuring an application that does not really exist.
Please ensure :ecto_gen exists or remove the configuration.
Background: I have a phoenix project and I have added dependecy ecto_gen (that I created) and it expects a configuration entry in config/config.exs:
defp deps do
[
{:ecto_gen, "~> 0.8", runtime: false}, # <---
{:gelfx, "~> 1.0"},
{:jason, "~> 1.0"}
]
end
It seems the setup I have does work e.g. the config values are read correctly when I run mix task of the ecto_gen dependency but the error on each start of recompiled app scares me quite often…
A common reason for an error like this is using the :applications key instead of :extra_applications in the application/0 function of your mix.exs. Perhaps that is the problem? If not maybe showing your whole mix.exs would be helpful.
Thanks for the reproducible project! The problem is that you need to add the :ecto_gen dependency to one of your applications in the umbrella, either :ecto_gen_error_reproduce or :ecto_gen_error_reproduce_web (or both). You should basically never add dependencies to the root mix.exs. Although I’m having some trouble finding where that is documented (I would’ve expected it to appear in https://elixir-lang.org/getting-started/mix-otp/dependencies-and-umbrella-projects.html#dependencies-within-an-umbrella-project).
Yes, in that case you should use config/config.exs for the configuration.
I see. That is intersting to hear…
In the beggining I was afraid that by moving to the nested app the mix task provided by ecto_gen package would be unaccessible from project root but thats not the case…
And it indeed removes the error.