0

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.

  1. mix compile - Successful
  2. iex -S mix phx.server - I can serve the api and no issues.
  3. Guardian can also authenticate the JWT token

So puzzled about deployment.

Building the code for edeliver

mix edeliver build release --verbose

Error:

    == Compilation error in file lib/pxf/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: [Pxf.Auth.Guardian], file: "/tmp/edeliver/pxf/builds/lib/pxf/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.647.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: Pxf.Auth.Guardian, requires: [Application, Guardian, Kernel, Kernel.Typespec], ...>
        
            # 2
            {:the_otp_app, [line: 2, counter: {Pxf.Auth.Guardian, 2}], Guardian}
        
            # 3
            [{:__MODULE__, [line: 2, counter: {Pxf.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/pxf/auth/guardian.ex:2: Pxf.Auth.Guardian (module)
        (elixir 1.12.2) expanding macro: Kernel.||/2
        lib/pxf/auth/guardian.ex:2: Pxf.Auth.Guardian (module)
        (elixir 1.12.2) expanding macro: Kernel.@/1
        lib/pxf/auth/guardian.ex:2: Pxf.Auth.Guardian (module)
        (guardian 2.3.1) expanding macro: Guardian.__using__/1

This is a previous project which was build with Phoenix 1.3.2 and I've migrated to Phoenix 1.6.15.

I'm new to this edeliver deployment and not sure whether it is the current way to push the code to the server?

tmariaz
  • 57
  • 1
  • 5
  • The release is compiled in `prod` and it seems your `prod.exs` has a malformed definition for what get read in `lib/pxf/auth/guardian.ex` via `Application.compile_env/3`. – Aleksei Matiushkin Mar 31 '23 at 17:48
  • My `prod.exs` seems to look good with just the Endpoint`import Config config :pixerf, PixerfWeb.Endpoint, http: [port: 4000], load_from_system_env: true, url: [host: "localhost", port: 4000], cache_static_manifest: "priv/static/cache_manifest.json", server: true, code_reloader: false # Do not print debug messages in production config :logger, level: :info` Guardian config seems to be correct as well. – tmariaz Apr 01 '23 at 09:53
  • Still same error. I have all my configuration in the `runtime.exs` file. Isn’t that right? – tmariaz Apr 01 '23 at 16:13
  • `Application.compile_env/3` cannot read `runtime.exs` for obvious reasons. – Aleksei Matiushkin Apr 01 '23 at 17:03
  • I don’t see any compile_env call in my code during runtime. – tmariaz Apr 02 '23 at 16:20

0 Answers0