Our phoenix app failed to start due to telemetry

Viewed 881

Our team is developing a Phoenix project and this week a new member joined us. He tries to work in a Docker environment on the Ubuntu 20.04 box.

He pulled the source code from our GitHub repo and found that our app failed to start with this error message:

[error] beam/beam_load.c(1883): Error loading module telemetry_app:
  This BEAM file was compiled for a later version of the run-time system than 22.
  To fix this, please recompile this module with an 22 compiler.
  (Use of opcode 169; this emulator supports only up to 168.)

[info]  Application telemetry exited: exited in: :telemetry_app.start(:normal, [])
    ** (EXIT) an exception was raised:
        ** (UndefinedFunctionError) function :telemetry_app.start/2 is undefined (module :telemetry_app is not available)
            (telemetry 0.4.2) :telemetry_app.start(:normal, [])
            (kernel 6.5.2.1) application_master.erl:277: :application_master.start_it_old/4

His output of mix hex.info is here:

Hex:    0.20.5
Elixir: 1.10.3
OTP:    22.3.4.2

Built with: Elixir 1.10.0 and OTP 21.3

We, except him, continue to work as usual. How can we help him?

We found a possible culprit: ElixirLS, a plugin for Visual Studio Code.

Other than him, our team members use text editors other than VSCode.

When he uninstall this plugin from VSCode, everything went well.

I don't know what is the root cause of this problem, but I suppose that this plugin compiles the dependencies of our project outside the Docker environment so that version mismatch occurs.

He tried to start our app by docker-compose up -d app.

The command specified in the command section in the docker-compose.yml is:

elixir --cookie xyz --sname xyz@app
      --erl "-kernel inet_dist_listen_min 6000 inet_dist_listen_max 6100" -S mix phx.server
2 Answers

I have deleted the ElixirLS extension files, and mix run, everything work fine, I don't know the reason, but I want to use ElixirLS: Elixir support and debugger.

In my case, I needed to clear out previously-built elixer files after an erlang downgrade.

My app also failed on the mix ecto.setup step with the same error:

 ** (UndefinedFunctionError) function :telemetry_app.start/2 is undefined (module :telemetry_app is not available)

But unlike the OP, I was not using the VSCode plugin.

In my case, I had downgraded the Erlang version but not cleared out the previously-built files.

I was also seeing this error:

10:49:07.305 [error] beam/beam_load.c(1883): Error loading module telemetry_app:
This BEAM file was compiled for a later version of the run-time system than 22.
To fix this, please recompile this module with an 22 compiler.
(Use of opcode 169; this emulator supports only up to 168.)

This elixerforum post told me what I needed to do instead. I needed to clear out those previously-built erlang/elixer files:

When downgrading Erlang versions, you must run

rm -rf deps/ _build/

within your project root

Related