`mix test` failing for umbrella project due to Phoenix LiveView

Background

I have a personal umbrella project where one of the child apps is a phoenix liveview app.

The project has the following structure:

market_manager
  |_apps
    |_ app1
    |_ app2
    |_ web_interface (phoenix live view app)

Problem

All works fine except when I run mix test. If I remove the PhoenixLiveView app the command works, but after adding I get the following error:

 mix test
warning: path "apps/.elixir_ls" is a directory but it has no mix.exs. Mix won't consider this directory as part of your umbrella application. Please add a "mix.exs" or set the ":apps" key in your umbrella configuration with all relevant apps names as atoms
warning: path "apps/.vscode" is a directory but it has no mix.exs. Mix won't consider this directory as part of your umbrella application. Please add a "mix.exs" or set the ":apps" key in your umbrella configuration with all relevant apps names as atoms
warning: Phoenix now requires you to explicitly list which engine to use
for Phoenix JSON encoding. We recommend everyone to upgrade to
Jason by setting in your config/config.exs:

    config :phoenix, :json_library, Jason

And then adding {:jason, "~> 1.0"} as a dependency.

If instead you would rather continue using Poison, then add to
your config/config.exs:

    config :phoenix, :json_library, Poison

  (phoenix 1.5.7) lib/phoenix.ex:38: Phoenix.start/2
  (kernel 6.5.2) application_master.erl:277: :application_master.start_it_old/4

==> web_interface
Compiling 17 files (.ex)

== Compilation error in file lib/web_interface_web/endpoint.ex ==
** (ArgumentError) invalid :json_decoder option. The module Poison is not loaded and could not be found
    (plug 1.10.3) lib/plug/parsers/json.ex:44: Plug.Parsers.JSON.validate_decoder!/1
    (plug 1.10.3) lib/plug/parsers/json.ex:31: Plug.Parsers.JSON.init/1
    (plug 1.10.3) lib/plug/parsers.ex:253: anonymous fn/3 in Plug.Parsers.convert_parsers/2
    (elixir 1.11.2) lib/enum.ex:2181: Enum."-reduce/3-lists^foldl/2-0-"/3
    (plug 1.10.3) lib/plug/parsers.ex:234: Plug.Parsers.convert_parsers/2
    (plug 1.10.3) lib/plug/parsers.ex:230: Plug.Parsers.init/1
    (plug 1.10.3) lib/plug/builder.ex:304: Plug.Builder.init_module_plug/4
    (plug 1.10.3) lib/plug/builder.ex:288: anonymous fn/5 in Plug.Builder.compile/3

Question

What am I missing here?

The child app can be found here:

Use mix phx.new.web within apps to generate a phoenix app, which is setup to run in an umbrella. Currently your umbrella config doesn’t include nor load the config of the phoenix app.

1 Like

When I run the command I get the following error:

λ mix phx.new.web test_app
** (Mix) Could not find "use Mix.Config" or "import Config" in "/market_manager/config/config.exs"

Which is confusing given this is the file in question:

import Config

import_config "#{Mix.env()}.exs"

What am I missing ?

Could it be because of my OS?

λ systeminfo | findstr /B /C:“OS Name” /C:“OS Version”
OS Name: Microsoft Windows 10 Home
OS Version: 10.0.19042 N/A Build 19042

How did you generate the web_interface project? It looks like it is not aware that it is meant to be part of an umbrella. If you run mix phx.new.web within the apps directory it should be generated appropriately.

An application inside an umbrella will generally have lines like:

 build_path: "../../_build",
 config_path: "../../config/config.exs",
 deps_path: "../../deps",
 lockfile: "../../mix.lock",

Within its project/0 function. There is an example of this in the official documentation:

I would try regenerating your web_interface application, and looking at the resulting git diff.

1 Like

How did you generate the web_interface project? It looks like it is not aware that it is meant to be part of an umbrella. If you run mix phx.new.web within the apps directory it should be generated appropriately.

I generated it with mix phx.new web_interface --no-ecto outside of the umbrella. Then as things evolved, I decided to move it inside the umbrella and to make it a part of my overall app.

I guess if there is no other way.