Cannot access Heroku postgres from CLI, SSL support issue - heroku

I'm having trouble connecting to my Postgres database on Heroku.
I run heroku pg:psql from the terminal, and get the error:
psql: sslmode value "require" invalid when SSL support is not compiled in
All the instances I find of this error online are php related, and it's only started acting up recently. Anybody know what's up with this?

Your local psql binary was not compiled with SSL support. You will need to locally recompile (or otherwise acquire for your os a binary of) postgres with SSL.

Related

Heroku pg:pull pg_dump extension/library version mismatch

I've just upgraded my Heroku app's PostgreSQL to version 12.
I'm currently having an issue with Heroku's pg:pull, where the extension/library from the server's pg_dump is apparently an older version:
pg_restore: error: could not execute query: ERROR: incompatible library "/usr/local/lib/postgresql/btree_gin.so": version mismatch
DETAIL: Server is version 10, library is version 12.
Command was: CREATE EXTENSION IF NOT EXISTS btree_gin WITH SCHEMA public;
The command I run is: heroku pg:pull ${SERVER_DB} ${DEV_DB} -a ${APP}
I have attempted ALTER EXTENSION btree_gin UPDATE; but it wasn't any help.
Any ideas?
I didn't realize that this error was concerning my local machine's PostgreSQL server version—not the server on Heroku.
Doing brew postgresql-upgrade-database would resolve this by upgrading the server version.
I ended up just deleting my existing local database and reinstalling PostgreSQL instead because running brew postgresql-upgrade-database involves copying entire tables; I didn't have enough space in local storage.

Ruby app no longer able to access remote Heroku Postgres - AFTER installing Postgres.app locally

For months now, a ruby (sinatra) app "foo.rb" on my dev't Mac has been using a remote Heroku-hosted Postgres database.
The app does not use ANY local database, neither in development nor production.
For another project, I installed Postgress.app from Heroku, first removing a very OLD version as recommended, using brew remove postgresql
The next time I ran foo.rb, and tried at access the (remote) database with SomeModel.count, I get the error:
PG::ConnectionBad: FATAL: no pg_hba.conf entry for host , user , database , SSL off
I'm confused why the error shows my devt machine address when the database connection config points to a remote postgres url, and why it says SSL off.
Any thoughts how to get rid of the error? Is there any way to see the PATH to the pg_hba.conf it is complaining about, so I can verify it contains the correct host entries?
(I wonder if the pg gem has its own copy squirreled away somewhere.)
The copies of pg_hba.conf that I can find (in /Library/Application Support/XXXX for both the old and new Postgress.app versions) have the correct (and unchanged) host entries.
It looks like your script is trying to connect somewhere that is not properly configured
Things to check in that case:
your database.yml or connection string, DATABASE_URL matches your localhost from postgres.app
is your postgres.app is running and have a db server running (check the elephant icon on the top bar of your osx)
You installed and configured properly the postgres app you need to set the path, you can check by typing psql in a new terminal window, if it runs is ok to go.
Configure your $PATH to use the included command line tools (optional):
sudo mkdir -p /etc/paths.d &&
echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp
post your file or part of it in the question, it helps a lot to debug :)
The answer turned out to be:
comment out pg in Gemfile
bundle install
replace pg
bundle install
I suspect when the gem pg is installed, it dynamically establishes some link to postgresql, so if you move postgresql (as I did when I installed Postgres.app) you need to remove the pg gem then re-add it.

heroku error: Unable to connect to heroku API

I'm trying to access heroku from my command line, and I keep getting this same error: "Unable to connect to heroku API. Please check your internet connectivity and try again."
My internet connectivity is fine.
This question has been asked on StackOverflow before, but I don't quite understand the answer that seemed to be effective, as I'm a complete newbie. Apparently, it might have to do with an environment variable?
The other answer suggested a missing heroku remote branch, but mine is set up.
What, exactly, should I do to regain my connection with heroku?
Thanks!
Get the same message "Unable to connect to heroku API. Please check your internet connectivity and try again." when using heroku toolbelt on Mac.
In my case I installed the heroku toolbelt using homebrew. Installing the heroku toolbelt from https://toolbelt.heroku.com/ can solve the issue.
Well, it seems to have been a problem with my antivirus program . . . I reinstalled that, and heroku is accessible again.
If you’re behind a firewall that requires use of a proxy to connect with external HTTP/HTTPS services, you can set the HTTP_PROXY or HTTPS_PROXY environment variables in your local developer environment, before running the heroku command.
For example, on a Unix system you could do something like this:
$ export HTTP_PROXY=http://proxy.server.com:portnumber
or
$ export HTTPS_PROXY=https://proxy.server.com:portnumber
$ heroku login
On a Windows machine, either set it in the System Properties/Environment Variables, or do it from the terminal:
> set HTTP_PROXY=http://proxy.server.com:portnumber
or
> set HTTPS_PROXY=https://proxy.server.com:portnumber
> heroku login
I Got the same error on Mac OS X 10.13, and it's work for me, since I am behind the proxy,It's gathered from the Heroku Dev center page
https://devcenter.heroku.com/articles/using-the-cli

Connection error when running memcached with dalli

I'm having trouble connecting to a Memcached server running on localhost from Dalli. I have been using Dalli with the Memcachier Heroku add-on for a while without any problems though I don't have any experience running Memcached locally.
I downloaded memcached with homebrew and it seems to have installed without a problem. I'm running it like this:
memcached -l 127.0.0.1 -p 11211 -vv
I can connect to the server and query it with
telnet 127.0.0.1 11211
The verbose output of memcached logs all the requests, so I know it's running fine. However, I'm unable to run it with Dalli. I am trying to connect like this:
require 'dalli'
dc = Dalli::Client.new('127.0.0.1:11211')
dc.set('foo', 123)
After I run the last command, Dalli unfailingly spits out
Dalli::RingError: No server available
from /Users/mac/.rvm/gems/ruby-1.9.3-p392/gems/dalli-2.6.4/lib/dalli/ring.rb:45:in `server_for_key'
from /Users/mac/.rvm/gems/ruby-1.9.3-p392/gems/dalli-2.6.4/lib/dalli/client.rb:347:in `perform'
from /Users/mac/.rvm/gems/ruby-1.9.3-p392/gems/dalli-2.6.4/lib/dalli/client.rb:199:in `set'
... so I'm getting this connection error, but I don't know why. Here's the weird part: Memcached is receiving the request, but it never succeeds in connecting. The following two lines are spit out by the verbose output whenever I try to connect:
<6 new client connection
<6 connection closed.
So what's going on here? Is this an authentication thing? Am I forgetting a command-line option?
EDIT: Figured out what was going on -- I was doing everything right except I was using the builtin version of Memcached. Installed the latest version and everything was fine.
Pretty simple issue, actually: I was just using an out-of-date Memcached version. No idea why that breaks Dalli, but installing a new Memcached fixed it.
That breaks dalli because dalli uses the newer binary memcached protocol instead of the older text-only protocol.
It does this for performance, but unfortunately makes dalli unusable with versions older than memcached 1.4

How do I update psql?

I am migrating our database on heroku but am having troubles with one of the steps described here: https://devcenter.heroku.com/articles/migrating-from-shared-database-to-heroku-postgres
When I run "heroku pg:psql HEROKU_POSTGRESQL_ORANGE" in terminal, I get the following:
psql (9.0.4, server 9.1.4)
WARNING: psql version 9.0, server version 9.1.
Some psql features might not work.
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.
df638608u79sh=>
I've tried updating psql with "brew update postresql", "gem update psql" and so furth, but neither of them runs.
Any help would be highly appreciated.
Thanks :)
You are not in the shell when you use heroku pg:psql HEROKU_POSTGRESQL_ORANGE, you are actually logged into a psql console instance. Postgres is already installed and configured for you

Resources