max_wen

max_wen

Ecto.create failure

i am following along with the Phoenix Up & Running guide at https://phoenixframework.readme.io/docs/up-and-running
and when I try to use ecto to create a database (Postgresql) I get the following error

$ mix ecto.create

17:55:35.631 [error] GenServer pid<0.215.0> terminating
** (RuntimeError) Connect raised a CaseClauseError error. The exception details are hidden, as they may contain sensitive data such
as database credentials.

(postgrex 0.12.2) lib/postgrex/utils.ex:40: Postgrex.Utils.parse_version/1
(postgrex 0.12.2) lib/postgrex/protocol.ex:497: Postgrex.Protocol.bootstrap_send/4
(postgrex 0.12.2) lib/postgrex/protocol.ex:353: Postgrex.Protocol.handshake/2
(db_connection 1.1.3) lib/db_connection/connection.ex:135: DBConnection.Connection.connect/2
(connection 1.0.4) lib/connection.ex:622: Connection.enter_connect/5
(stdlib 3.11.2) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

Last message: nil

State: Postgrex.Protocol

** (Mix) The database for HelloPhoenix.Repo couldn’t be created: an exception was raised:
** (RuntimeError) Connect raised a CaseClauseError error. The exception details are hidden, as they may contain sensitive data such
as database credentials.

    (postgrex 0.12.2) lib/postgrex/utils.ex:40: Postgrex.Utils.parse_version/1
    (postgrex 0.12.2) lib/postgrex/protocol.ex:497: Postgrex.Protocol.bootstrap_send/4
    (postgrex 0.12.2) lib/postgrex/protocol.ex:353: Postgrex.Protocol.handshake/2
    (db_connection 1.1.3) lib/db_connection/connection.ex:135: DBConnection.Connection.connect/2
    (connection 1.0.4) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib 3.11.2) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

The only suggestions I found was to update Postgrex. I ran mix deps.update postgrex and this did not fix it.

Finally I checked config/dev.exs and username/password are set to “postgres”. I used PgAdmin3 to confirm this is a valid login.

So at this point I am stuck.

Ubuntu 19.10

postgres (PostgreSQL) 11.7 (Ubuntu 11.7-0ubuntu0.19.10.1)
installed from Ubuntu repo via apt-get

thanks

Marked As Solved

NobbZ

NobbZ

As I said already, the best is to ditch the guide you follow, and remove the empty project you have so far. Then you mix archive.uninstall phoenix_new, as that is deprecated and only creates outdated project skeletons.

Then you start again by following the new guide, updating all those dependencies like NodeJS, Elixir, Erlang while you go, though at least the latter two usually do not need extra updating.

Also Liked

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Try setting show_sensitive_data_on_connection_error: true in the config block for your repo.

NobbZ

NobbZ

Because there is a lot more of dated dependencies, probably something puts a constraint on postgrex that makes it unable to update.

If you put {:postgrex, "~> 0.13"} in your mix.exs and then mix do deps.unlock postgrex, deps.update postgrex again, it will tell you where constraints are comming from.

PS: Also do not put >= as a version constraint unless you really know what you are doing.

PPS: ecto 2.0.6 had a constraint on postgrex that basically narrows it to 0.12.x.

PPPS: You really should ditch that old, outdated and deprecated guide in favor of the new hexdocs hosted: Up and Running — Phoenix v1.8.8, how have you actually found that other one? Those aren’t linked from the phoenix homepage anymore for years…

max_wen

max_wen

sorry i did not read the 3rd PS. I will do that and follow the new guide on hexdocs. thanks again.

$ mix archive.uninstall phoenix_new
Are you sure you want to uninstall /home/max/.mix/archives/phoenix_new? [Yn] Y

Done!

UPDATE: I followed the Install instructions and Up and Running at hexdocs.pm and saw the Phoenix Framework page being served on localhost. No hiccups even with ecto. thanks for the assistance.

Last Post!

max_wen

max_wen

sorry i did not read the 3rd PS. I will do that and follow the new guide on hexdocs. thanks again.

$ mix archive.uninstall phoenix_new
Are you sure you want to uninstall /home/max/.mix/archives/phoenix_new? [Yn] Y

Done!

UPDATE: I followed the Install instructions and Up and Running at hexdocs.pm and saw the Phoenix Framework page being served on localhost. No hiccups even with ecto. thanks for the assistance.

Where Next?

Popular in Questions Top

RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
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
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New

Other popular topics Top

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
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44167 214
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
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
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 42576 114
New