Issue in logging phoenix error

I have recently setup a new project with phoenix 1.4. The issue I am facing currently is with phoenix error log. No matter what the reason is, this is the error log I am getting always:

[error] #PID<0.1430.0> running ApolloWeb.Endpoint (connection #PID<0.1419.0>, stream id 4) terminated
Server: localhost:4000 (http)
Request: GET /questions
** (exit) an exception was raised:
    ** (CaseClauseError) no case clause matching: {:error, :beam_lib, {:invalid_beam_file, <<70, 79, 82, 49, 0, 0, 11, 100, 66, 69, 65, 77, 65, 116, 85, 56, 0, 0, 0, 236, 0, 0, 0, 24, 14, 99, 111, 119, 98, 111, 121, 95, 104, 97, 110, 100, 108, 101, 114, 7, 101, 120, 101, 99, 117, ...>>, 2924}}
        (elixir) lib/code.ex:1102: Code.do_fetch_docs/1
        (plug) lib/plug/debugger.ex:328: Plug.Debugger.has_docs?/3
        (plug) lib/plug/debugger.ex:315: Plug.Debugger.get_doc/4
        (plug) lib/plug/debugger.ex:257: Plug.Debugger.each_frame/4
        (elixir) lib/enum.ex:1418: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
        (elixir) lib/enum.ex:1418: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
        (plug) lib/plug/debugger.ex:249: Plug.Debugger.frames/2
        (plug) lib/plug/debugger.ex:183: Plug.Debugger.render/6
        (plug) lib/plug/debugger.ex:147: Plug.Debugger.__catch__/5
        (apollo) lib/apollo_web/endpoint.ex:1: ApolloWeb.Endpoint.call/2
        (phoenix) lib/phoenix/endpoint/cowboy2_handler.ex:34: Phoenix.Endpoint.Cowboy2Handler.init/2
        (cowboy) /Users/jyotigautam/apollo/deps/cowboy/src/cowboy_handler.erl:41: :cowboy_handler.execute/2
        (cowboy) /Users/jyotigautam/apollo/deps/cowboy/src/cowboy_stream_h.erl:296: :cowboy_stream_h.execute/3
        (cowboy) /Users/jyotigautam/apollo/deps/cowboy/src/cowboy_stream_h.erl:274: :cowboy_stream_h.request_process/3
        (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

Is there any requirement of some extra setup to show correct error messages? Where am I going wrong? Please help.

I do see this the first time to be honest, have you tried purging your deps and _build dirs and then rebuilding deps and application?

2 Likes

I tried purging _build before this, but was getting the same error. Now it’s showing the error messages after I have purged both _build and deps. Thanks for the approach.

I feel like I have seen this error very recently… I wish I could remember what the solution was. Have you recently updated elixir? What elixir version are you on?

EDIT: I think I kind of remember it was something about the elixir version. Updating helped.

I am using elixir version 1.7.4

I am talking out of my ass here, but I think you need to either recompile your elixir version with an updated OTP version (21 is the latest) or update elixir to 1.8

Are you using asdf to manage your Elixir and Erlang versions?

1 Like

Ahhh, yeah that was it, that’s where I saw that error!

But I am not using asdf to manage elixir versions.

Anything else? Or do you use system provided binaries? If the latter how did you install them and what are their corresponding versions?

I just used the installation guide from https://elixir-lang.org/install.html#mac-os-x
Not using any version controller at the moment.

What version of erlang do you have installed and how did you install it?

brew or ports? And have you checked the erlang version?

Also have you tried updating elixir as well as erlang to their latest versions?

1 Like

I have installed it using brew and haven’t switched the version as of now.

And have you checked your erlang version?

Why haven’t you tried updating to 1.8 as suggested earlier?

1 Like

Erlang OTP version is 21 and the elixir version is 1.7.4. Btw it’s working fine after purging deps and _build

1 Like

You said in Issue in logging phoenix error, that hadn’t helped… Now I’m confused…

1 Like

yes there was this issue but after your first reply, it got resolved