ZastrixArundell

ZastrixArundell

Can't start comeonin with Bcrypt

I am adding user Authentication to my webapp and for some reason I am having issues and really don’t know how to solve it (I don’t know if it’s an error on my side or a bug).

(Just as an heads up, I am using windows and I have nmake installed)

I try to add comeonin and Bcrypt like so:

     {:comeonin, "~> 5.0"},
     {:bcrypt_elixir, "~> 2.0"}

Then I do mix deps,get and mix deps.compile bcrypt_elixir, which works completely well and I don’t get any errors.

When I do mix phoenix.server I get the following warning (I am using hash_pwd_salt/1):

warning: function Comeonin.Bcrypt.hash_pwd_salt/1 is undefined or private. Did you mean one of:

      * hashpwsalt/1
      * hashpwsalt/2

If I try using hashpwsalt/1 I get:

** (exit) an exception was raised:
    ** (ArgumentError) Comeonin.Bcrypt.hashpwsalt has been removed.
Add {:bcrypt_elixir, "~> 2.0"} to the deps in your mix.exs file,
and use Bcrypt.hash_pwd_salt instead.

        lib/comeonin/base.ex:32: Comeonin.Bcrypt.error/2
        (ecto) lib/ecto/changeset.ex:1004: Ecto.Changeset.update_change/3
        (dealmailer) web/controllers/user_controller.ex:12: Dealmailer.UserController.create/2
        (dealmailer) web/controllers/user_controller.ex:1: Dealmailer.UserController.action/2
        (dealmailer) web/controllers/user_controller.ex:1: Dealmailer.UserController.phoenix_controller_pipeline/2
        (dealmailer) lib/dealmailer/endpoint.ex:1: Dealmailer.Endpoint.instrument/4
        (dealmailer) lib/phoenix/router.ex:261: Dealmailer.Router.dispatch/2
        (dealmailer) web/router.ex:1: Dealmailer.Router.do_call/2
        (dealmailer) lib/dealmailer/endpoint.ex:1: Dealmailer.Endpoint.phoenix_pipeline/1
        (dealmailer) lib/plug/debugger.ex:123: Dealmailer.Endpoint."call (overridable 3)"/2
        (dealmailer) lib/dealmailer/endpoint.ex:1: Dealmailer.Endpoint.call/2
        (plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
        (cowboy) c:/Users/Zastrix/Documents/Phoenix/dealmailer-phoenix/deps/cowboy/src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4

Then I try to downgrade my versions:

     {:comeonin, "~> 4.0"},
     {:bcrypt_elixir, "~> 1.0"}

And I get the dependencies and compile, everything is okay. I don’t get warnings in console when I start the app but when I do actually run it… I get this again (I am using hashpwsalt/1 here)

** (exit) an exception was raised:
    ** (ArgumentError) Comeonin.Bcrypt.hashpwsalt has been removed.
Add {:bcrypt_elixir, "~> 2.0"} to the deps in your mix.exs file,
and use Bcrypt.hash_pwd_salt instead.

        lib/comeonin/base.ex:32: Comeonin.Bcrypt.error/2
        (ecto) lib/ecto/changeset.ex:1004: Ecto.Changeset.update_change/3
        (dealmailer) web/controllers/user_controller.ex:12: Dealmailer.UserController.create/2
        (dealmailer) web/controllers/user_controller.ex:1: Dealmailer.UserController.action/2
        (dealmailer) web/controllers/user_controller.ex:1: Dealmailer.UserController.phoenix_controller_pipeline/2
        (dealmailer) lib/dealmailer/endpoint.ex:1: Dealmailer.Endpoint.instrument/4
        (dealmailer) lib/phoenix/router.ex:261: Dealmailer.Router.dispatch/2
        (dealmailer) web/router.ex:1: Dealmailer.Router.do_call/2
        (dealmailer) lib/dealmailer/endpoint.ex:1: Dealmailer.Endpoint.phoenix_pipeline/1
        (dealmailer) lib/plug/debugger.ex:123: Dealmailer.Endpoint."call (overridable 3)"/2
        (dealmailer) lib/dealmailer/endpoint.ex:1: Dealmailer.Endpoint.call/2
        (plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
        (cowboy) c:/Users/Zastrix/Documents/Phoenix/dealmailer-phoenix/deps/cowboy/src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4

Marked As Solved

wolfiton

wolfiton

Hi,

Can you update your bcrypt to use {bcrypt, "~> 2.0.3"},

Also have a look at the docs Bcrypt — bcrypt_elixir v3.3.2

Can you also share the file where you use bcrypt to register the users?

Also Liked

LostKobrakai

LostKobrakai

Yes and no. comeonin still holds the behaviour all the concrete packages implement. It’s a dependency of all of them. If you depend on the behaviour of comeonin and not just a single concrete implementation I feels it’s still good to list comeonin as explicit dependency. Because switching to another password hashing package does not change your dependency on the common interface.

Where Next?

Popular in Questions Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New

Other popular topics Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New

We're in Beta

About us Mission Statement