max_wen
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/3Last 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
Trending in Questions
Other Trending Topics
Latest Phoenix Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #ai
- #iex
- #graphql
- #elixirconf-us
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
benwilson512
Try setting
show_sensitive_data_on_connection_error: truein the config block for your repo.max_wen
Thanks.
I had to google to find how to update that setting and it seems to be a common question. Based on another ElixirForum answer I updated config.exs thus
and still I get the following error on mix ecto.create
should the setting be updated differently? thanks
1player
I don’t know exactly what is going on but
postgrexseems to be failing parsing a version, I expect the database’s…You’re on PostgreSQL 11.7 which is from Feb 2020, but your
postgrexis very old: v0.12.2 was released in Sep 2016.Try updating your
postgrexlibrary version, the latest is v0.15.3.And/or change the version requirement in your mix.exs file
max_wen
Ran your commands and it installs 0.12.2 again. Why wouldn’t it install the latest?
lucaong
Can you show your
depsinmix.exs? Most likely,postgrexis pinned to a specific version.If that’s the case, you can change the version pinning to something like
~> 0.15.max_wen
this is the default setting after
mix phoenix.newNobbZ
Because there is a lot more of dated dependencies, probably something puts a constraint on
postgrexthat makes it unable to update.If you put
{:postgrex, "~> 0.13"}in yourmix.exsand thenmix do deps.unlock postgrex, deps.update postgrexagain, 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:
ecto2.0.6 had a constraint onpostgrexthat basically narrows it to0.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
ok thank you but I did not put that. this is the default mix.exs file. but what you say makes sense. here is the result
so how do I decipher this? Does ecto need updating? thx
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.
max_wen
sorry i did not read the 3rd PS. I will do that and follow the new guide on hexdocs. thanks again.
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.