jaxon icon indicating copy to clipboard operation
jaxon copied to clipboard

Failed to load NIF

Open bjunc opened this issue 5 years ago • 3 comments

When deploying to k8s / docker, I'm getting a missing NIF error:

{:error, {:load_failed, 'Failed to load NIF library: \'/opt/app/_build/prod/lib/jaxon/priv/decoder.so: invalid ELF header\''}}

Any thoughts? Works in local / dev environment.

bjunc avatar Jun 27 '19 17:06 bjunc

hi @bjunc, This could happen if you compile the Elixir app in OS X and then try to run it in a Docker Linux image.

Is it possible that you're compiling your app in a different machine than the Docker image?

boudra avatar Jul 08 '19 15:07 boudra

Hmm. I am indeed on OSX, and I am running the app in a Docker image. However, in my Dockerfile, I'm running:

FROM elixir:1.8

# a bunch of other steps...

# last step
RUN mix deps.get --only prod && MIX_ENV=prod mix compile

Shouldn't that compile the app within the Elixir base image (not OSX)?

bjunc avatar Jul 08 '19 22:07 bjunc

@boudra I'm not 100% certain, but I think I found the issue. I did not have a .dockerignore for this project yet, which was allowing the _build folder to be copied over. I think that was creating a conflict where the dev (OSX) Nif was being used instead of the Linux Nif for production. Does that seem logical?

bjunc avatar Aug 11 '19 21:08 bjunc