mix-test.watch
mix-test.watch copied to clipboard
Error running watch with bcrypt usage
The first run when using mix test.watch
is successful, but after a file change, there is an error when bcrypt is called (from Comeonin) as the seeds are run (which happens before our test run). The error describes an option to upgrade the bcrypt_elixir
version, which has already been upgraded, and also which seems to be an odd error given that the tests do run successfully the first time around.
{"time":"2018-07-20 15:14:57.138","pid":"#PID<0.32.0>","msg":"Process #PID<0.825.0> raised an exception\n** (RuntimeError) An error occurred when loading Bcrypt.\nMake sure you have a C compiler and Erlang 20 installed.\nIf you are not using Erlang 20, either upgrade to Erlang 20 or\nuse version 0.12 of bcrypt_elixir.\nSee the Comeonin wiki for more information.\n\n (bcrypt_elixir) lib/bcrypt/base.ex:17: Bcrypt.Base.init/0\n (kernel) code_server.erl:1340: anonymous fn/1 in :code_server.handle_on_load/5","level":"error","error_logger":"format"}
** (UndefinedFunctionError) function Bcrypt.Base.gensalt_nif/3 is undefined (module Bcrypt.Base is not available)
(bcrypt_elixir) Bcrypt.Base.gensalt_nif([60, 82, 233, 149, 33, 172, 112, 100, 157, 214, 2, 171, 128, 189, 134, 157], 4, 98)
(bcrypt_elixir) lib/bcrypt.ex:52: Bcrypt.gen_salt/2
(bcrypt_elixir) lib/bcrypt.ex:88: Bcrypt.hash_pwd_salt/2
priv/repo/seeds.exs:24: (file)
(elixir) lib/code.ex:629: Code.load_file/2
{"time":"2018-07-20 15:14:57.804","pid":"#PID<0.826.0>","msg":"The on_load function for module Elixir.Bcrypt.Base returned:\n{%RuntimeError{message: \"An error occurred when loading Bcrypt.\\nMake sure you have a C compiler and Erlang 20 installed.\\nIf you are not using Erlang 20, either upgrade to Erlang 20 or\\nuse version 0.12 of bcrypt_elixir.\\nSee the Comeonin wiki for more information.\\n\"}, [{Bcrypt.Base, :init, 0, [file: 'lib/bcrypt/base.ex', line: 17]}, {:code_server, :\"-handle_on_load/5-fun-0-\", 1, [file: 'code_server.erl', line: 1340]}]}\n","level":"warn","error_logger":"format"}
{"time":"2018-07-20 15:14:57.806","pid":"#PID<0.712.0>","msg":"GenServer #PID<0.712.0> terminating\n** (UndefinedFunctionError) function Bcrypt.Base.gensalt_nif/3 is undefined (module Bcrypt.Base is not available)\n (bcrypt_elixir) Bcrypt.Base.gensalt_nif([60, 82, 233, 149, 33, 172, 112, 100, 157, 214, 2, 171, 128, 189, 134, 157], 4, 98)\n (bcrypt_elixir) lib/bcrypt.ex:52: Bcrypt.gen_salt/2\n (bcrypt_elixir) lib/bcrypt.ex:88: Bcrypt.hash_pwd_salt/2\n priv/repo/seeds.exs:24: (file)\n (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6\n (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3\n (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3\n (elixir) lib/code.ex:629: Code.load_file/2\nLast message: {:EXIT, #PID<0.74.0>, {%UndefinedFunctionError{arity: 3, exports: nil, function: :gensalt_nif, module: Bcrypt.Base, reason: nil}, [{Bcrypt.Base, :gensalt_nif, [[60, 82, 233, 149, 33, 172, 112, 100, 157, 214, 2, 171, 128, 189, 134, 157], 4, 98], []}, {Bcrypt, :gen_salt, 2, [file: 'lib/bcrypt.ex', line: 52]}, {Bcrypt, :hash_pwd_salt, 2, [file: 'lib/bcrypt.ex', line: 88]}, {:elixir_compiler_2, :__FILE__, 1, [file: 'priv/repo/seeds.exs', line: 24]}, {:elixir_compiler, :dispatch, 6, [file: 'src/elixir_compiler.erl', line: 85]}, {:elixir_lexical, :run, 3, [file: 'src/elixir_lexical.erl', line: 18]}, {:elixir_compiler, :quoted, 3, [file: 'src/elixir_compiler.erl', line: 27]}, {Code, :load_file, 2, [file: 'lib/code.ex', line: 629]}]}}","level":"error","error_logger":"format"}
{"time":"2018-07-20 15:14:57.807","pid":"#PID<0.716.0>","msg":"GenServer #PID<0.716.0> terminating\n** (UndefinedFunctionError) function Bcrypt.Base.gensalt_nif/3 is undefined (module Bcrypt.Base is not available)\n (bcrypt_elixir) Bcrypt.Base.gensalt_nif([60, 82, 233, 149, 33, 172, 112, 100, 157, 214, 2, 171, 128, 189, 134, 157], 4, 98)\n (bcrypt_elixir) lib/bcrypt.ex:52: Bcrypt.gen_salt/2\n (bcrypt_elixir) lib/bcrypt.ex:88: Bcrypt.hash_pwd_salt/2\n priv/repo/seeds.exs:24: (file)\n (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6\n (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3\n (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3\n (elixir) lib/code.ex:629: Code.load_file/2\nLast message: {:EXIT, #PID<0.74.0>, {%UndefinedFunctionError{arity: 3, exports: nil, function: :gensalt_nif, module: Bcrypt.Base, reason: nil}, [{Bcrypt.Base, :gensalt_nif, [[60, 82, 233, 149, 33, 172, 112, 100, 157, 214, 2, 171, 128, 189, 134, 157], 4, 98], []}, {Bcrypt, :gen_salt, 2, [file: 'lib/bcrypt.ex', line: 52]}, {Bcrypt, :hash_pwd_salt, 2, [file: 'lib/bcrypt.ex', line: 88]}, {:elixir_compiler_2, :__FILE__, 1, [file: 'priv/repo/seeds.exs', line: 24]}, {:elixir_compiler, :dispatch, 6, [file: 'src/elixir_compiler.erl', line: 85]}, {:elixir_lexical, :run, 3, [file: 'src/elixir_lexical.erl', line: 18]}, {:elixir_compiler, :quoted, 3, [file: 'src/elixir_compiler.erl', line: 27]}, {Code, :load_file, 2, [file: 'lib/code.ex', line: 629]}]}}","level":"error","error_logger":"format"}
Environment: macOS 10.13.4 Docker 18.03.1-ce-mac64 docker-compose 1.21.0 elixir 1.6.4
Can you provide an minimal example project that has the problem please? :)
@lpil https://github.com/athal7/test_watch_bcrypt
This started happening to me on erlang 23.
Environment: macOS: 10.15.5 Elixir: 1.10.3 Erlang: 23.0.2
I'm absolutely not sure of this, but it looks a lot like and may be related to https://github.com/riverrun/argon2_elixir/issues/39. If so, it may be fixed by the next Erlang/OTP release as José Valim mentioned.