tmariaz
I am trying to deploy the app with edeliver. However during the … I get the following error. Not sure what is it actually means. Though in the dev environment it works fine.
- mix compile - Successful
- iex -S mix phx.server - I can serve the api and no issues.
- Guardian can also authenticate the JWT token
So puzzled about deployment.
Building the code for edeliver
mix edeliver build release --verbose
Error:
Changed release version from 0.2.1 to 0.2.1+3-59fa8ac
Compiling 284 files (.ex)
== Compilation error in file lib/pxrf/auth/guardian.ex ==
** (FunctionClauseError) no function clause matching in Application."MACRO-compile_env"/4
The following arguments were given to Application."MACRO-compile_env"/4:
# 1
#Macro.Env<aliases: [], context: nil, context_modules: [Pxrf.Auth.Guardian], file: "/tmp/edeliver/pxrf/builds/lib/pxrf/auth/guardian.ex", function: nil, functions: [{Kernel, [!=: 2, !==: 2, *: 2, +: 1, +: 2, ++: 2, -: 1, -: 2, --: 2, /: 2, <: 2, <=: 2, ==: 2, ===: 2, =~: 2, >: 2, >=: 2, abs: 1, apply: 2, apply: 3, binary_part: 3, bit_size: 1, byte_size: 1, ceil: 1, div: 2, elem: 2, exit: 1, floor: 1, function_exported?: 3, get_and_update_in: 3, get_in: 2, hd: 1, inspect: 1, inspect: 2, is_atom: 1, is_binary: 1, is_bitstring: 1, is_boolean: 1, is_float: 1, is_function: 1, is_function: 2, ...]}], lexical_tracker: #PID<0.644.0>, line: 2, macro_aliases: [], macros: [{Kernel, [!: 1, &&: 2, ..: 2, ..//: 3, <>: 2, @: 1, alias!: 1, and: 2, binding: 0, binding: 1, def: 1, def: 2, defdelegate: 2, defexception: 1, defguard: 1, defguardp: 1, defimpl: 2, defimpl: 3, defmacro: 1, defmacro: 2, defmacrop: 1, defmacrop: 2, defmodule: 2, defoverridable: 1, defp: 1, defp: 2, defprotocol: 2, defstruct: 1, destructure: 2, get_and_update_in: 2, if: 2, in: 2, is_exception: 1, is_exception: 2, is_nil: 1, is_struct: 1, is_struct: 2, ...]}], module: Pxrf.Auth.Guardian, requires: [Application, Guardian, Kernel, Kernel.Typespec], ...>
# 2
{:the_otp_app, [line: 2, counter: {Pxrf.Auth.Guardian, 2}], Guardian}
# 3
[{:__MODULE__, [line: 2, counter: {Pxrf.Auth.Guardian, 2}], Guardian}, :permissions]
# 4
nil
(elixir 1.12.2) lib/application.ex:505: Application."MACRO-compile_env"/4
(elixir 1.12.2) expanding macro: Application.compile_env/2
lib/pxrf/auth/guardian.ex:2: Pxrf.Auth.Guardian (module)
(elixir 1.12.2) expanding macro: Kernel.||/2
lib/pxrf/auth/guardian.ex:2: Pxrf.Auth.Guardian (module)
(elixir 1.12.2) expanding macro: Kernel.@/1
lib/pxrf/auth/guardian.ex:2: Pxrf.Auth.Guardian (module)
(guardian 2.3.1) expanding macro: Guardian.__using__/1
A remote command failed on:
user@server
Output of the command is shown above and the command executed
on that host is printed below for debugging purposes:
FAILED with exit status 1:
[ -f /Users/username/.profile ] && source /Users/username/.profile
set -e
cd /tmp/edeliver/pxrf/builds
if [ "mix" = "rebar3" ]; then
echo "using rebar3 to compile files"
[[ "true" != "true" ]] && ./rebar3 clean || :
./rebar3 compile
elif [ "mix" = "rebar" ]; then
echo "using rebar to compile files"
[[ "true" != "true" ]] && ./rebar clean skip_deps=true || :
./rebar compile
elif [ "mix" = "mix" ] && [ "mix" = "mix" ]; then
echo "Checking whether deps must be compiled for mix version 1.3.[01234]"
# see https://github.com/boldpoker/edeliver/issues/94
if mix --version | grep 'Mix 1.3.[01234]' >/dev/null 2>&1 ; then
echo "Compiling deps because mix version 1.3.[01234] is used"
APP="pxrf" MIX_ENV="prod" mix deps.compile
fi
if [[ "true" = "true" ]]; then
APP="pxrf" MIX_ENV="prod" AUTO_VERSION="commit-count+git-revision+branch-unless-master" BRANCH="master" SKIP_RELUP_MODIFICATIONS="" RELUP_MODIFICATION_MODULE="" USING_DISTILLERY="true" mix do release.version --verbose, compile
else
APP="pxrf" MIX_ENV="prod" AUTO_VERSION="commit-count+git-revision+branch-unless-master" BRANCH="master" SKIP_RELUP_MODIFICATIONS="" RELUP_MODIFICATION_MODULE="" USING_DISTILLERY="true" mix do clean, release.version --verbose, compile
fi
elif [ "mix" = "mix" ]; then
echo "using mix to compile files"
if [[ "true" = "true" ]]; then
if [[ -n "commit-count+git-revision+branch-unless-master" ]]; then
hint_message 'Using --auto-version together with --skip-mix-clean would not work!'
fi
APP="pxrf" MIX_ENV="prod" AUTO_VERSION="commit-count+git-revision+branch-unless-master" BRANCH="master" SKIP_RELUP_MODIFICATIONS="" RELUP_MODIFICATION_MODULE="" USING_DISTILLERY="true" mix do deps.compile, release.version --verbose, compile
else
APP="pxrf" MIX_ENV="prod" AUTO_VERSION="commit-count+git-revision+branch-unless-master" BRANCH="master" SKIP_RELUP_MODIFICATIONS="" RELUP_MODIFICATION_MODULE="" USING_DISTILLERY="true" mix do clean, deps.compile, release.version --verbose, compile
fi
fi
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted”
Version...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex










Showing Posts 1 to 7- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
al2o3cr
Can you show the first few lines of this module? The error message suggests there’s something weird being passed to
Application.compile_envthere.tmariaz
Here is the guardian code
Not sure why it’s looking for compile_env here. Also this happens only during edeliver. However during normal local
mix phx.serverit works fine without error.Is that means sometime to do with
runtime.exs?al2o3cr
Here’s the part of
Guardian.__using__/1that’s failing to compile:https://github.com/ueberauth/guardian/blob/d8c87e3779ebfd77d2f2f4de523825eac9bcc8a0/lib/guardian.ex#L351-L357
The underlying issue is the Elixir version - 1.12 has a bug where using a local variable (or module attribute) as the first argument to
Application.compile_env/3produces exactly the error message you’re seeing:https://github.com/elixir-lang/elixir/pull/11383
High-five to @eksperimental for this fix!
I’m still not sure why this only happens when running
edeliver, though; is it possible it’s picking up the wrong version of the compiler?tmariaz
So that means I shouldn’t use
edeliver? This bug isn’t addressed inedeliverrepo I guess.What is the best way do deploy to an AWS instance? If not via edeliver which support hot updates as well?
I thought of changing to
elixir: "~> 1.13"will fix the issue but still the same. While fetching dependencies it always stops for:pheonix_swaggerand I had to execute theedeliver releaseagain.Error:
This is happening only for
:phoenix_swagger. Every time I domix deps.clean --alland funmix deps.getI get this error as well and I had to run the deps.get command again. Not sure why.al2o3cr
To clarify: the bug I highlighted was unrelated to
edeliver, it means that you can’t use Elixir 1.12 together with Guardian 2.3.1.The connection to
edeliverwas that it appears that onlyedeliverwas trying to use this combination;mix compileandmix phx.serverweren’t seeing the error.Can you post the
applicationsection of yourmix.exs? Theedeliverreadme suggests adding toapplications:which is no longer recommended (useextra_applicationsinstead, or rely on Mix auto-detection), and that can cause weird behavior.tmariaz
I didn’t add
edeliverto applications because I ran into error running. So I removed totally.Anyway here is application block from
mix.exsMaybe I’ll try adding to
extra_applicationsand run edeliver. Also I triedmix releaseand it works fine but CI/CD workflow isn’t great with cross platform. I understand the build won’t work if compiled on a Mac and deployed on Ubuntu. I have an AWS instance which I need to deploy for staging before migrating to production.Finding alternative deployment for deploying to AWS. Previously this project was running with
edeliverprior elixir 1.9.So still exploring the better way for deployment.
tmariaz
Update:
Adding
edeliverto the extra_applications didn’t work either.