Issues with gettext in production

Hi gents,

I’m trying to upgrade our app from Elixir 1.3.3 to 1.6.5 and hit an issue with building for production. Mainly with compiling gettext:

 → MIX_ENV=prod mix deps.compile gettext
==> gettext
Compiling 20 files (.ex)
warning: redefining module Gettext.Backend (current version loaded from /Users/alg/p/picsafe-key-server/_build/prod/lib/gettext/ebin/Elixir.Gettext.Backend.beam)
  lib/gettext/backend.ex:1

warning: redefining module Gettext.Compiler (current version loaded from /Users/alg/p/picsafe-key-server/_build/prod/lib/gettext/ebin/Elixir.Gettext.Compiler.beam)
  lib/gettext/compiler.ex:1

warning: redefining module Gettext (current version loaded from /Users/alg/p/picsafe-key-server/_build/prod/lib/gettext/ebin/Elixir.Gettext.beam)
  lib/gettext.ex:1

warning: redefining module Gettext.Extractor (current version loaded from /Users/alg/p/picsafe-key-server/_build/prod/lib/gettext/ebin/Elixir.Gettext.Extractor.beam)
  lib/gettext/extractor.ex:1

warning: redefining module Gettext.Error (current version loaded from /Users/alg/p/picsafe-key-server/_build/prod/lib/gettext/ebin/Elixir.Gettext.Error.beam)
  lib/gettext.ex:483

warning: redefining module Gettext.ExtractorAgent (current version loaded from /Users/alg/p/picsafe-key-server/_build/prod/lib/gettext/ebin/Elixir.Gettext.ExtractorAgent.beam)
  lib/gettext/extractor_agent.ex:1


== Compilation error in file lib/gettext/extractor.ex ==
** (CompileError) lib/gettext/extractor.ex:120: Gettext.PO.__struct__/1 is undefined, cannot expand struct Gettext.PO
    lib/gettext/extractor.ex:112: (module)
could not compile dependency :gettext, "mix compile" failed. You can recompile this dependency with "mix deps.compile gettext", update it with "mix deps.update gettext" or clean it with "mix deps.clean gettext"

Any ideas what might be wrong?

When you upgrade the elixir or erlang version, always make sure you build from a clean state.

$ rm -rf _build deps
$ mix do deps.get, deps.compile

Then build your application as you are used to it.

3 Likes

Oh, I think this is what I missed:

I built and ran it in development and test environments just fine. But when I decided to test the production build, it started crashing on me with that error.

I will remember removing deps and build folder next time. Thanks!

Case closed.

Btw, this was not supposed to be necessary. Maybe it was the large version bump (from v1.3 to v1.6) that triggered it. I will investigate.

Yeah, I would think so. Never noticed anything like it before. It wasn’t a version bump per se. I spent a day in dev/test making the app work on new version (1.6.6) and then just ran MIX_ENT=prod mix compile only to see it wouldn’t compile. So it’s something else. Just in case it’s helpful…

1 Like

What triggered this for me was that I did not have my elixir_buildpack.config file in the root of my project

1 Like