zyro / elixir-uuid

UUID generator and utilities for Elixir
Apache License 2.0
361 stars 84 forks source link

function UUID.uuid4/0 is undefined (module UUID is not available) #36

Closed akrisanov closed 5 years ago

akrisanov commented 5 years ago

I'm building the OTP release using Distillery with MIX_ENV=prod mix release --env=prod --verbose and running the foreground process. The application fails when one of the hex packages tries to call UUID.uuid4() function. I tried to connect to the remote console and call the function manually:

iex(driver_location@127.0.0.1)1> UUID.uuid4()
** (UndefinedFunctionError) function UUID.uuid4/0 is undefined (module UUID is not available)
    UUID.uuid4()

I don't have such a problem when I run the application via mix:

~/D/A/driver-location ❯❯❯ iex -S mix run
Erlang/OTP 21 [erts-10.1.3] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe] [dtrace]

Interactive Elixir (1.7.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> UUID.uuid4()
"caf94bb3-a34d-4013-943c-befd590bdb16"

Any ideas why it could happen?

akrisanov commented 5 years ago

I resolved the issue by adding :uuid into extra_applications:

# Run "mix help compile.app" to learn about applications.
def application do
  [
    extra_applications: [:logger, :uuid]
  ]
end
zyro commented 5 years ago

Glad it's solved! 👍

akrisanov commented 5 years ago

Maybe it would be helpful to add a sentence in README.md about that for such newbies as me :)