** (Postgrex.Error) FATAL 28000 (invalid_authorization_specification) no pg_hba.conf entry for host "router_public_ip", user "user", database "postgres", SSL off
Issues
It’s for some reason reading router_public_ip and not ip of pg_instance.elephantsql.com. Setting IP manually in config doesn’t help.
It’s reading the user correctly. But database is “postgres” instead of “db” (as mentioned in url)
You might need to set ssl: true in your repo configuration. Not sure why it might be trying to connect to the wrong database. Do you have an init function in your MyApp.Repo module?
Can you post your Myapp.Repo.init/2 callback code? This looks a little bit like maybe your init function is overwriting the URL (or some other part of the configuration).
Where is the DB hosted? Just a guess, but if you have access, check the postgres configuration there.
router_public_ip looks as if it’s not set up in the remote pg_hba.conf which is generating this connection error. Check if there is an entry in pg_hba.conf for the upstream router’s IP (NATed?) and/or if the router is passing router_public_ip as a hostname etc.
I ran into this same issue, it an issue that comes from how elephantsql shared resources work.
The solution is to specify the maintenance database, there is such a configuration that you can add to your repo config in config.ex