Can't Start App as a Child App in an Umbrella

My app works fine alone, however, if I tried to run it within an umbrella setup, I get an error:

here is what I did: (at the root of umbrella folder)

mix local.rebar
rm -rf deps
rm -rf _build
mix deps.get
iex -S mix phoenix.server

Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

===> Compiling pooler
===> Compiling src/pooler_starter.erl failed
src/pooler_starter.erl:34: export_all flag enabled - all functions will be exported

** (Mix) Could not compile dependency :pooler, "/Users/samir/.mix/rebar3 bare compile --paths "/Users/samir/Documents/projects/elixir/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile pooler", update it with "mix deps.update pooler" or clean it with "mix deps.clean pooler"

although I can start it if I run the commandiex -S mix phoenix.server at the app folder itself.

here is the mix.exs of the umbrella main app:

defmodule TrackwareProjects.Mixfile do
use Mix.Project
def project do
    [apps_path: "apps",
     build_embedded: Mix.env == :prod,
     start_permanent: Mix.env == :prod,
     deps: deps()]
  end
  defp deps do
    []
  end
end

the config.exs of the umbrella main app:

use Mix.Config
import_config "../apps/*/config/config.exs"

Any idea?

Is there something in your global configuration that treats warnings as errors? Perhaps some overrides in a .iex file, as it seems to work when you not use iex

The sub-app can work independently, but not within the Umbrella, don’t have global configuration that treats warnings as errors…

Then please try to DEBUG=1 iex -S mix.phoenix.server, this should enforce rebar too give away more information…

Also I found a bug report that 1.5.2 of :pooler has problems with OTP 20: https://github.com/seth/pooler/issues/76

Perhaps your issue is related? Then I do wonder though, why it works in the sub app but not in the context of the umbrella.

Anyway, can you recreate a minimal project that recreates the issue?

using DEBUG=1 I got those errors:

✗ DEBUG=1 iex -S mix phoenix.server
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

===> Expanded command sequence to be run: []
===> Expanded command sequence to be run: [{default,app_discovery},
                                           {bare,compile}]
===> Evaluating config script "/Users/samir/Documents/projects/elixir/deps/pooler/rebar.config.script"
===> Evaluating config script "/Users/samir/Documents/projects/elixir/deps/pooler/rebar.config.script"
===> Compiling pooler
===> run_hooks("/Users/samir/Documents/projects/elixir/deps/pooler", pre_hooks, compile) -> no hooks defined

===> run_hooks("/Users/samir/Documents/projects/elixir/deps/pooler", pre_hooks, erlc_compile) -> no hooks defined

===> erlopts [debug_info,
              {d,namespaced_types},
              debug_info,warnings_as_errors,inline]
===> files to compile ["/Users/samir/Documents/projects/elixir/deps/pooler/src/pooler_sup.erl",
                       "/Users/samir/Documents/projects/elixir/deps/pooler/src/pooler_starter_sup.erl",
                       "/Users/samir/Documents/projects/elixir/deps/pooler/src/pooler_starter.erl",
                       "/Users/samir/Documents/projects/elixir/deps/pooler/src/pooler_pooled_worker_sup.erl",
                       "/Users/samir/Documents/projects/elixir/deps/pooler/src/pooler_pool_sup.erl",
                       "/Users/samir/Documents/projects/elixir/deps/pooler/src/pooler_config.erl",
                       "/Users/samir/Documents/projects/elixir/deps/pooler/src/pooler_app.erl",
                       "/Users/samir/Documents/projects/elixir/deps/pooler/src/pooler.erl"]
===>      Compiled pooler_sup.erl
===>      Compiled pooler_starter_sup.erl
===> Compiling src/pooler_starter.erl failed
src/pooler_starter.erl:34: export_all flag enabled - all functions will be exported

===> Compilation failed: {error,[],
                                [["src/pooler_starter.erl:34: export_all flag enabled - all functions will be exported\n"]]}
** (Mix) Could not compile dependency :pooler, "/Users/samir/.mix/rebar3 bare compile --paths "/Users/samir/Documents/projects/elixir/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile pooler", update it with "mix deps.update pooler" or clean it with "mix deps.clean pooler"

As you can see here, for some reason warnings are treated as errors here. Now we need to find out why this happens in the umbrella but not in the sub-app.

Can you compare the output (especially configscript- and preehook-pathes) when doing the same in the sub-app? Of course you need to mix clean pooler there first.

when I do:

$ cd apps/trackware
$ mix clean pooler
$ DEBUG=1 iex -S mix phoenix.server

the app starts normally without any issue, so what output to compare ?

The output of rebar3 building :pooler

If there is no :pooler built in the application that you are in, then you are not in the sub-app that makes you a problem…