Weird errors in umbrella app

I have an umbrella application and I can’t seem to find a way to start it (it’s not mine, I’m just working on it)

If I try to run the phoenix app inside it or try to run migrations I’ve got the following error:

[error] GenServer #PID<0.1165.0> terminating
** (CaseClauseError) no case clause matching: [10, 4, 4, 18, 4]
    (postgrex) lib/postgrex/utils.ex:69: Postgrex.Utils.parse_version/1
    (postgrex) lib/postgrex/protocol.ex:641: Postgrex.Protocol.bootstrap_send/6
    (postgrex) lib/postgrex/protocol.ex:475: Postgrex.Protocol.handshake/2
    (db_connection) lib/db_connection/connection.ex:134: DBConnection.Connection.connect/2
    (connection) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol

It seems like it can’t connect to the database but the config is the same as in one of my working app (only the db name is different).

If I try to take a look in iex I’ve got a different error:

** (Mix) Could not start application logger: Logger.App.start(:normal, []) returned an error: shutdown: failed to start child: Logger.WatcherSupervisor
    ** (EXIT) an exception was raised:
        ** (MatchError) no match of right hand side value: {:error, {{{:case_clause, {:EXIT, {:undef, [{LoggerFileBackend, :init, [{LoggerFileBackend, :error_log}], []}, {:gen_event, :server_add_handler, 4, [file: 'gen_event.erl', line: 473]}, {:gen_event, :handle_msg, 6, [file: 'gen_event.erl', line: 318]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}}}, [{Logger.Watcher, :init, 1, [file: 'lib/logger/watcher.ex', line: 28]}, {:gen_server, :init_it, 2, [file: 'gen_server.erl', line: 374]}, {:gen_server, :init_it, 6, [file: 'gen_server.erl', line: 342]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}, {:child, :undefined, {Logger.WatcherSupervisor, {Logger, {LoggerFileBackend, :error_log}}}, {Logger.Watcher, :start_link, [{Logger, {LoggerFileBackend, :error_log}, {LoggerFileBackend, :error_log}}]}, :transient, 5000, :worker, [Logger.Watcher]}}}
            (logger) lib/logger/watcher_supervisor.ex:14: anonymous fn/2 in Logger.WatcherSupervisor.start_link/1
            (elixir) lib/enum.ex:1925: Enum."-reduce/3-lists^foldl/2-0-"/3
            (logger) lib/logger/watcher_supervisor.ex:13: Logger.WatcherSupervisor.start_link/1
            (stdlib) supervisor.erl:379: :supervisor.do_start_child_i/3
            (stdlib) supervisor.erl:365: :supervisor.do_start_child/2
            (stdlib) supervisor.erl:349: anonymous fn/3 in :supervisor.start_children/2
            (stdlib) supervisor.erl:1157: :supervisor.children_map/4
            (stdlib) supervisor.erl:315: :supervisor.init_children/2

I’m using Elixir 1.7.1 with OTP 21 if it matters.

:wave:

Yeah, that’s a weird error.

I’ve seen something like this being mentioned on this forum before though.


Can you try updating postgrex?


Have you run the migrations?

1 Like

Thank you so much!

That fixed the postgrex error! I was able to run the migrations and start my phoenix application.

Unfortunately the logger bug is still with me when I try to get in iex in one of my apps.

:+1:

Can you show your mix.exs file for the app which fails?

Do you have a dependency on :logger_file_backend defined there somewhere (perhaps in deps)?

defp deps do
  [
    # ...
    {:logger_file_backend, "~> 0.0.10"} # or whatever its version is
    # ...
  ]
end

Judging by the error, the runtime just can’t find it

** (MatchError) no match of right hand side value: {:error, {{{:case_clause, {:EXIT, {:undef, [{LoggerFileBackend, :init, [{LoggerFileBackend, :error_log}]


A similar issue on github:

1 Like

There is a bug in Elixir v1.7.1 where it tries to load some dependencies when it should not. I don’t think this is actually the case here but you can give v1.7.2 a try, which was released today.

3 Likes

Updating Elixir didn’t solve the issue but adding the logger_file_backend dependency to the subapp solved it!

It is very interesting because I’ve been working on this app for a while and I didn’t run in this issue before. Recently I had my OS reinstalled and had to clone the app again, after this I had this problem.

Thanks, @idi527, and @josevalim for your help!

1 Like

I’m also having the :logger issue when trying to run tests inside an app in the Umbrella project. No problem when running from root.

I’m running on:

erlang 21.1
elixir 1.7.3-otp-21

and in my case I had to add the following to my other apps

 {:flex_logger, "~> 0.2.1", only: :test}