简体   繁体   中英

Elixir build on Heroku review app fails with (ArgumentError) argument error :erlang.binary_to_atom(nil, :utf8) when running mix release

We have a Phoenix application that has been running in production on Heroku for the last year.

Now I am attempting to enable pull request versions of the application to run via review apps as part of a Heroku pipeline.

The application has three Heroku buildpacks:

  1. https://buildpack-registry.s3.amazonaws.com/buildpacks/hashnuke/elixir.tgz
  2. https://github.com/gjaldon/heroku-buildpack-phoenix-static
  3. our own buildpack (see below)

Our own buildpack is very straightforward. Here is the bin/detect script:

#!/bin/sh

exit 0

And here is the bin/compile script:

#!/bin/bash

cd $1
mix release

Whilst the build has been working for production, unfortunately for the PR which is designed to enable review apps, it is failing when it gets to the final buildpack. Here is the relevant output from the Heroku build:

-----> https://github.com/orgname/buildpack-name.git app detected
** (ArgumentError) argument error
    :erlang.binary_to_atom(nil, :utf8)
    (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
    (stdlib) erl_eval.erl:878: :erl_eval.expr_list/6
    (stdlib) erl_eval.erl:236: :erl_eval.expr/5
    (stdlib) erl_eval.erl:228: :erl_eval.expr/5
    (stdlib) erl_eval.erl:878: :erl_eval.expr_list/6
    (stdlib) erl_eval.erl:404: :erl_eval.expr/5
 !     Push rejected, failed to compile https://github.com/orgname/buildpack-name.git app.
 !     Push failed

So it seems to be failing in the mix release step but the error message doesn't give me a good idea of why. I have found a similar problem report , which suggests that the problem I'm trying to solve may be due to one or more missing environment variables. However, I've double checked and can't see any environment variables that are missing.

Any suggestions about how I might solve this problem would be most welcome.

Thanks to Aleksei Matiushkin for his comments, which helped me track down the cause of the problem.

I had introduced a new environment variable, which I was fetching in both config/prod.exs and config/releases.exs . When I removed it from config/prod.exs then mix release succeeded in building the release for the Heroku review app.

I guess the moral of this story is to not configure a value both at build-time and runtime.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM