kacperM7

kacperM7

mix ecto.create does not work due to the plug_crypto issue

Hi all,

I have a problem with setting up simple phoenix app with mix phx.new. Weirdest thing is - it worked last week without a problem and now I don’t know what I changed (I am almost sure it was nothing) and why it’s not working.

Problem: when creating new project with mix phx.new, after I cd into new directory and run mix ecto.create I get:

10:39:36.405 [error] GenServer #PID<0.292.0> terminating
** (UndefinedFunctionError) function :crypto.hmac/3 is undefined or private
    (crypto 5.0.2) :crypto.hmac(:sha256, "postgres", <<236, 186, 74, 106, 223, 211, 23, 71, 163, 135, 42, 171, 252, 96, 232, 70, 0, 0, 0, 1>>)
    (postgrex 0.15.0) lib/postgrex/scram.ex:52: Postgrex.SCRAM.hash_password/6
    (postgrex 0.15.0) lib/postgrex/scram.ex:26: Postgrex.SCRAM.verify/2
    (postgrex 0.15.0) lib/postgrex/protocol.ex:734: Postgrex.Protocol.auth_cont/4
    (postgrex 0.15.0) lib/postgrex/protocol.ex:579: Postgrex.Protocol.handshake/2
    (db_connection 2.4.0) lib/db_connection/connection.ex:82: DBConnection.Connection.connect/2
    (connection 1.1.0) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib 3.15.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol

As stated - this was working already before. I tried to uninstall everything phoenix/elixir related and redeploy. I am pretty sure the versions did not change.
I googled that error and it seems it was related to the deprecation of that function in OTP24, but that was some time ago (not over the weekend). In my mix.exs I see following entries:

      {:plug, "~> 1.12"},
      {:plug_crypto, "~> 1.1.2 or ~> 1.2"},

It would mean I have the latest dependencies there.
I am rather new to phoenix so I would need some guidance on where to look next.

Most Liked

Ninigi

Ninigi

Wild guess, postgrex is using a function from a newer OTP version now.

Another wild guess, you did not run into that issue last week, because you were using locked versions, but in your newest project, it installed the latest postgrex version (because afaik postgrex in phoenix is anything above 0.0.0)

You can open the mix.lock file in one of your older projects, and lock ecto and posgrex to the same versions, or you can try to update your Elixir/OTP version.

EDIT: give me a message if you don’t know what I am talking about :smiley:

Where Next?

Popular in Questions 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
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
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
Lily
In templates/appointment/index.html.eex: &lt;%= for appointment &lt;- @appointments do %&gt; &lt;tr&gt; &lt;td&gt;&lt;%= appoi...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

Other popular topics Top

JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 53690 245
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a &gt; b) do {:ok, "a"} end if (a &lt; b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

We're in Beta

About us Mission Statement