When I perform my elixir / phoenix application locally.
mix phx.server
Start normally.
But when I put it in the container, it returns me
Instrumenter.Phoenix.init / 1 is undefined or private
My application has the distiller and I’m integrating the prometheus in Phoenix.
What could be happening?
idi527
July 5, 2019, 5:27pm
#2
What could be happening?
One unlikely possibility is your container uses an environment different from dev
(which is what you usually use with mix phx.server
) for which Instrumenter.Phoenix
wasn’t compiled.
When posting an error, please always include the full stack trace.
Stacktrace:
** (UndefinedFunctionError) function Test.Instrumenter.Phoenix.init/1 is undefined or private
EudorosProducerWeb.Instrumenter.Phoenix.init([])
(plug) lib/plug/builder.ex:302: Plug.Builder.init_module_plug/4
(plug) lib/plug/builder.ex:286: anonymous fn/5 in Plug.Builder.compile/3
(elixir) lib/enum.ex:1948: Enum."-reduce/3-lists^foldl/2-0-"/3
(plug) lib/plug/builder.ex:284: Plug.Builder.compile/3
(plug) expanding macro: Plug.Builder.__before_compile__/1
lib/eudoros_producer_web/endpoint.ex:1: Test.Endpoint (module)
ERROR: Service 'web' failed to build: The command '/bin/sh -c mix deps.get --only prod && mix compile' returned a non-zero code: 1
NobbZ
July 5, 2019, 6:46pm
#5
Is there a ENV MIX_ENV=prod
in the docker file before the failing line?
If not, then it will try to compile as dev
but misses dependencies, as you only downloaded for prod
before…