humankindof

humankindof

** (Postgrex.Error) FATAL 08P01 (protocol_violation) no such database: postgres

I have had success with this even recently but Im missing something now.

I am simply attempting to connect with a remote database on a new phoenix installation.

The service is not called “postgres” buy my_app is still looking for a db named Postgres apparently.

replacing the primary database connection, not adding a second.

same result using both a clean install, or a template from fullstackphoenix.

I followed this guide
https://hexdocs.pm/phoenix/deployment.html
among other guides for database migrations such as:
https://hexdocs.pm/ecto_sql/Ecto.Migration.html

I configure the adapter in config/devs.ex file with the appropriate credentials

  username: "NOT_postgres",
  password: "NOT_postgres",
  hostname: "remote_connection-pool_digital-ocean.com",
  database: "NOT_postgres",
  port: "25061",
  ssl: true,
  ssl_opts: [verify: :verify_peer, cacertfile: 'ca-certificate.crt'],
  stacktrace: true,
  show_sensitive_data_on_connection_error: true,
  pool_size: 10

Then any mix ecto gets this error

11:19:58.852 [error] GenServer #PID<0.398.0> terminating
** (Postgrex.Error) FATAL 08P01 (protocol_violation) no such database: postgres
    (db_connection 2.4.2) lib/db_connection/connection.ex:100: DBConnection.Connection.connect/2
    (connection 1.1.0) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib 4.1.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol

I am wondering where else I need to declare db credentials. Or if there is something else simple I am forgetting.

I have tried adding credential in config/test.exs but it didn’t make a difference. and considered add to runtime.exs, but runtime.exs loads database_url from system environment exports. which are set.

Any assistance would be of value. Thanks…

Most Liked

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Hi @humankindof if you are editing the dev.exs file, but are doing a deployment, that wont’ work. dev.exs configures your local development environment. When you do a deployment it’s running in the prod environment, and so you need to be setting values in runtime.exs.

You’ll see your runtime.exs file has an area enclosed in this block:

if config_env() == :prod do
# put your prod postgres details here
end
humankindof

humankindof

That was it man. Thank You.

Where Next?

Popular in Questions Top

lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
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
pgiesin
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database. Dep...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
sacepums
Hey guys. I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
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
beno
I will often find my self writing things similar to: case some_value do nil -&gt; something() "" -&gt; something() _ -&gt; someth...
New
jc00ke
Expanding on this topic: https://forum.elixirforum.net/t/map-typespec-question/19217 Let’s say I have a map with required and optional k...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

Other popular topics Top

peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
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
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

We're in Beta

About us Mission Statement