Config failed at runtime

hello, i got a problem running my app in different platform. Here is how I run it:

$ MIX_ENV=dev mix release
$ _build/dev/rel/conf_srv/bin/conf_srv start

in my dev computer:

$ lsb_release -a
No LSB modules are available.
Distributor ID:    Debian
Description:    Debian GNU/Linux 10 (buster)
Release:    10
Codename:    buster

everything runs fine. But in another dev computer:

$ lsb_release -a
No LSB modules are available.
Distributor ID:    Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:    11
Codename:    bullseye

I get this error:

ERROR! Config provider Config.Reader failed with:
** (FunctionClauseError) no function clause matching in :lists.foldl/3
    (stdlib 3.6) lists.erl:1262: :lists.foldl(#Function<60.119039201/2 in :erl_eval.merge_bindings/2>, %{}, %{})
    (stdlib 3.6) erl_eval.erl:411: :erl_eval.expr/5
    (stdlib 3.6) erl_eval.erl:273: :erl_eval.expr/5
    (stdlib 3.6) erl_eval.erl:449: :erl_eval.expr/5
    (elixir 1.12.2) src/elixir.erl:280: :elixir.recur_eval/3
    (elixir 1.12.2) src/elixir.erl:265: :elixir.eval_forms/3
    (elixir 1.12.2) lib/code.ex:656: Code.eval_string_with_error_handling/3
    (elixir 1.12.2) lib/config.ex:258: Config.__eval__!/3

Here is my Elixir env:

$ elixir -v
Erlang/OTP 24 [erts-12.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]

Elixir 1.12.2 (compiled with Erlang/OTP 24)

any advice?

1 Like

Are you sure non of these are violated between Debian 10 and Debian 11: mix release — Mix v1.13.3

1 Like

I am not sure I follow your question? I read your link and didn’t find any thing strange in my config / mix files. Or how exactly can I check for violations?

In both computers, I removed the _build folder, compiled the project from scratch and then run. I only got the error in 1 computer.

Any more clue?

1 Like

Ah, so you’re not having problems using a release - built on one computer - and run on the other, but you have problems building and running on the same system. Then you can disregard my previous post.

1 Like

I made a small test. Following this link Up and Running — Phoenix v1.6.6, I created and compiled the hello project. Everything went well. I could mix phx.server without problem.

Now, after mix release and run the release as per on-screen instruction, I got the same error as originally described above.

So, something wrong with mix release?

The issue might also be in the erlang/otp or elixir installations on your systems.

Indeed. I reinstall Erlang and Elixir using Asdf, now it works. Not sure what was wrong with cloning OTP and Elixir and compiling them from source manually, since Asdf also does the same!

Btw, I wrote a script for installing Elixir using Asdf, just share here if it can help anyone:

#!/usr/bin/env bash

sudo apt install -y unzip build-essential autoconf libssl-dev libncurses5-dev curl git

if [ ! -d ~/.asdf ]; then
  git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.0
fi

touch ~/.bashrc
installed=`grep -q asdf ~/.bashrc; echo $?`
if [ $installed -eq 0 ]; then
  echo "ASDF already installed!"
else
  echo ". $HOME/.asdf/asdf.sh" >> ~/.bashrc
  echo ". $HOME/.asdf/completions/asdf.bash" >> ~/.bashrc
fi

. ~/.asdf/asdf.sh
. ~/.asdf/completions/asdf.bash

asdf plugin add erlang
asdf install erlang latest
ver=`asdf list erlang`
echo "Setting Elang version $ver..."
asdf global erlang $ver

asdf plugin add elixir
asdf install elixir latest
ver=`asdf list elixir`
echo "Setting Elixir version $ver..."
asdf global elixir $ver

source ~/.bashrc