13

I'm getting this error, but obviously I'm connected! I entered a ticket with Heroku 15 hours ago but received no response.

C:\>heroku config
Enter your Heroku credentials.
Email: myemail@mydomain
Password (typing will be hidden):
 !    Unable to connect to Heroku API, please check internet connectivity and try again.

$ heroku status
 !    Unable to connect to Heroku API, please check internet connectivity and try again.

I even re-installed Heroku client. I even pushed to Heroku while this problem was happening through Git.

Chloe
  • 25,162
  • 40
  • 190
  • 357
  • 1
    did you run `heroku login` first? It seems it doesn't have your credentials... – raviolicode Mar 09 '14 at 05:30
  • I was connected before. I did use Heroku login, and it still gives that error. – Chloe Mar 09 '14 at 05:49
  • seems you're really have some kind of connectivity issue. You should try adding a debugger on the `heroku` gem, here is the [code that gives the exception](http://rubydoc.info/gems/heroku/3.1.0/Heroku/Command#run-class_method), line 260. Good luck... I wish I could help you more, but it seems one of those bugs difficult to track. – raviolicode Mar 09 '14 at 06:34
  • Have a look at this [thread](http://stackoverflow.com/questions/21467590/heroku-permission-denied-unable-to-connect-to-heroku-api) – anuragal Mar 09 '14 at 10:08
  • @anuragal It's not git related. I see the Heroku remotes. `$ git remote -v` `heroku git@heroku.com:appname.git`. – Chloe Mar 09 '14 at 21:17
  • @raviolicode I can't find the file to debug! I put `puts "*** run(#{cmd}, #{arguments})"` at the top of the run method in `C:\Program Files (x86)\Heroku\lib\heroku\command.rb`, yet it doesn't print anything! – Chloe Mar 09 '14 at 21:52
  • use `require 'ruby-debug'; debugger` before the line you need to debug, and make sure you have installed `gem install debugger`. I think you should but a debugger on line 260 of that file, to see if this is really giving you the error of connectivity or if it's another thing. First make sure it's really stopping in the debugger. – raviolicode Mar 09 '14 at 23:57
  • Ok I installed the debugger and put `require 'ruby-debug'; debugger` on line 253 (line 252 without my `puts`) and it didn't work and still gave the same error with `heroku status`. I don't think that will work because Heroku uses its own Ruby, and when I run `gem install`, it is installing in my normal Ruby, not the Ruby Heroku uses. I even put syntax errors in that `command.rb` file and it still spits out the same error. – Chloe Mar 10 '14 at 00:13

6 Answers6

20

It was because of a missing certificate authority file. The environment variable was pointing to a file that wasn't there.

SSL_CERT_FILE=C:\ruby200\cacert.pem

I wish it gave an error message.

Chloe
  • 25,162
  • 40
  • 190
  • 357
  • I am running in to same issue with deploying Node app to heroku. Any ideas? – Mike Jul 10 '14 at 10:54
  • I suppose Heroku still uses the same toolbelt app for Node, so maybe check the `$SSL_CERT_FILE` exists? Try downloading a CA cert list from `Curl` and putting it in the Heroku Ruby directory with a link. Verify you can use `curl` to access Heroku via SSL. – Chloe Jul 11 '14 at 05:25
  • 2
    Glad you found your answer, but I've got the same error message but not the same missing file. The error handling in this thing is terrible. – Rob Grant Sep 09 '14 at 23:22
  • 1
    Its solved my problem. Here it solve too http://stackoverflow.com/questions/5720484/how-to-solve-certificate-verify-failed-on-windows#answer-16134586 – Selvamani Apr 14 '15 at 12:41
1

I want to offer one more piece of clarification here in case the above answer (which is correct) is still unclear. To fix this issue, look up your "Environment Variables" via start menu. On the bottom, you'll see a list of system varibles. Where you see SSL_CERT_FILE follow the path to see if the value path actually exists.

In my case, I had moved a bunch of files around so it was no longer in the correct place. I found a replacement cacert.pem file and replaced the incorrect value. This fixed the connection issue.

Ahmed Haque
  • 7,174
  • 6
  • 26
  • 33
1

For newbies out there using the cloud9 IDE. It's embarrassing to post this but it might help to refresh the browser (If using cloud9 IDE). Sometimes, Cloud9 has minor issues with connectivity.

Rick G
  • 53
  • 1
  • 9
0

This other SO answer solved it for me.

Basically, my heroku remote was missing.

If there isn't a remote branch set up, do heroku git:remote -a my-app-name and it should configure it.

Community
  • 1
  • 1
Scott Coates
  • 2,462
  • 5
  • 31
  • 40
0

For me, it was because I was using an old version of the Heroku CLI/Toolbelt. Even after running heroku update, it was still stuck at version 3.12.1.

To fix, I just uninstalled that old version, and installed the newest version from: https://devcenter.heroku.com/articles/heroku-cli

Venryx
  • 15,624
  • 10
  • 70
  • 96
0

When picking up an old laptop I ran into this issue too. There is a bit that pointed me in the right direction at the end of this article: https://devcenter.heroku.com/articles/heroku-cli#uninstalling-the-legacy-heroku-gem

So in my case, heroku sat at /usr/local/heroku instead of /usr/local/bin/heroku.

I ended up executing rm -rf /usr/local/heroku. If you try this too, be sure this is relevant to you, it might make a mess out of things. Ugly solution but problem solved.

Jasper Kennis
  • 3,225
  • 6
  • 41
  • 74