cannot connect heroku - when writing heroku update - ruby on rails - ruby-on-rails

i am trying to connect heroku
i downloaded heroku toolbelt and installed it .
then from the command prompt i type :
heriku login
althogh i type the right credentials (i checked!!) i get
! Unable to connect to Heroku API, please check internet connectivity and
try again.
I wanted to be sure its not something with authentication
so i typed :
heroku update
just to set up a connection that doesn't need a password.
i get the message:
! Unable to connect to Heroku API, please check internet connectivity and
try again.
i saw some answers that talked about the remote option so i did that:
heroku git:remote -a my-app-name
and i got the same response.
the internet connection is ok because the git program is able to push to github.
even when i run
heroku install:something
it works.
so I tried to debug:
i downloaded a git bash so i can operate in unix through SSH
and I followed this stack question comments and tried it:
ssh git#heroku.com -T
and got :
warning permanently added the RSA host key for ip address '50.19.85.132' to the list of
known hosts.
permission denied (publickey)
then I tried to check DNS response:
ssh host heroku.com
and got :
ssh: host: no address associated with the name.
so i guess that my connection get blocked regardless of SSH .
i run netstat -a and it seems that port: 22 , 443 , 5000 that heroku uses are free.
i turned the firewall off and still no conection
what should i do?

Try heroku login first. It authenticates you.

Related

heroku pg:psql not working [connection refused]

I am running a Ruby on Rails app on Heroku with Postgres Database.
I used to be able to connect to my database from my terminal using heroku pg:psql command
Recently, things have changed. After running heroku pg:psql command, I get the following error.
--> Connecting to postgresql-perpendicular-94363
psql: could not connect to server: Connection refused
Is the server running on host "ec2-23-23-130-158.compute-1.amazonaws.com" (23.23.130.158) and accepting
TCP/IP connections on port 5432?
I tried to search online about it, but nothing useful has been found.
Please help. Thanks 😄
I've just tried connect to your database:
psql "dbname=postgresql-perpendicular-94363 host=ec2-23-23-130-158.compute-1.amazonaws.com user=test_user port=5432 sslmode=require"
And I've got:
psql: FATAL: password authentication failed for user "test_user"
Because, of course I don't know you credentials :)
However, it seems that connection works. I suppose, that you forgot set sslmode. As you can see in documentation, it is required:
All connections require SSL: sslmode=require.
Update:
I've checked connection without sslmode, and message is other than yours:
FATAL: no pg_hba.conf entry for host "31.42.24.63", user "test_user", database "postgresql-perpendicular-94363", SSL off
So, I suppose that this is a problem with you internet connection. Check you firewall setup.
As per the description mentioned in the post, the way you have specified is correct.
Moreover you can also try the below mentioned command where you specify the database as well.
heroku pg:psql DATABASE_URL
Note: This is only used when there are multiple databases linked.

cannot connect to Heroku Postgres - error "server closed the connection unexpectedly"

I am trying to use the Heroku CLI to connect a Postgres database in the cloud.
heroku pg:info shows the database information, but heroku pg:psql fails with the following error:
$ heroku pg:psql
--> Connecting to postgresql-<database-id>
psql: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
What's wrong?
Port 5432 must be unblocked for psql to work and I was unable to do that. Switching to a different network (e.g. Internet provider at home or mobile Internet) may help.
Might not be the issue for everyone, but if you have a computer set up to connect with mTLS by having a ~/.postgresql/postgresql.crt and ~/.postgresql/postgresql.key, psql will automatically send the key up to all databases you connect to, and you will break heroku pg:psql connections to other databases
So just
mv ~/.postgresql{,.bak}
and try again. If that's your issue, you'll want to put your mTLS certs in a different directory and manually pass them as arguments or via config vars
The location of the certificate and key files can be overridden by the
connection parameters sslcert and sslkey or the environment variables
PGSSLCERT and PGSSLKEY

Connection refusal when pushing to Heroku, Bitbucket

I have had no issue pushing to Heroku or Bitbucket over the past few weeks. Now whenever I issue the command $ git push , or $ git push heroku I receive the same message:
ssh: connect to host git.bitbucket.org port 22: Connection refused
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have been using the cloud9 IDE, pushing to BitBucket with no issue, and am really at my wits end in trying to determing why I can't push anymore....
Any advice out there?
It sounds like you haven't authorized your computer's SSH key. You'll need to log into Heroku / bitbucket and make sure that your local ~/.ssh/id_rsa.pub file is appropriately copied over.
For Heroku, if you're using their command line tool, you can add your SSH keys easily:
$ heroku keys:add
Just had this same problem. I had to restart the C9 server and things worked fine after that.

Unable to add Git repository hosted on OS X Server

I created a repository on OS X Server called myTestRepo. For HTTPS Access, I am allowing logged in users to read and write.
When I try to add this repository in Xcode, I get an error.
In repository address, if I enter
ssh://iMac/git/myTestRepo.git
I get the following error
Could not read from remote repository.
If I enter
https://iMac/git/myTestRepo.git
I get the following error
fatal: unable to access 'https://iMac/git/myTestRepo.git/': Could not resolve host:iMac
What am I doing wrong?
This could be a DNS problem in your local network:
Try substituting "iMac" with the IP adress of the computer hosting the repo:
ifconfig |grep inet
(in Terminal) will print out your local IP (e.g. 192.168.18.15).
If this doesn't help try pinging the IP / Computername (iMac) to see if you are able to connect to the computer:
ping iMac
ping 192.168.18.15
I also found a good tutorial on how to setup git Mac OSX Server. http://www.tomdalling.com/blog/software-processes/how-to-set-up-a-secure-git-server-at-home-osx/
Pay attention to the port forwarding section, did you forward ports correctly?

Problem with git push remote behind proxy

To set the context, I am trying to use the toto to set up my blog.
I did
$ sudo gem install toto
and the gems were installed properly.
Successfully installed rdiscount-1.6.8
Successfully installed toto-0.4.9
2 gems installed
After that, I tried
$ git clone git://github.com/cloudhead/dorothy.git myblog
but I get the following error
Cloning into myblog...
github.com[0: 207.97.227.239]: errno=Connection timed out
fatal: unable to connect a socket (Connection timed out)
My git http proxy settings are correct
jatin#jatin-ubuntu:~/myblog$ git config --global http.proxy
http://proxy:port
My http_proxy settings are also correct
jatin#jatin-ubuntu:~$ echo $http_proxy
http://proxy:port/
So, I replaced git by http, as
$ git clone http://github.com/cloudhead/dorothy.git myblog
and it worked.
Now, when I do the following
$ cd myblog
$ heroku create myblog
it works till here and I get
Creating myblog...... done
Created http://myblog.heroku.com/ | git#heroku.com:myblog.git
Git remote heroku added
But it fails down here:
$ git push heroku master
and the following error comes up
ssh: connect to host heroku.com port 22: Connection timed out
fatal: The remote end hung up unexpectedly
I didn't know what to do, so after Googling a bit I found that you can't push changes to github using http.
On digging in further, I found this link
how-to-use-the-git-protocol-through-a-http-connect-proxy
which says that you can have your firewall administrator configure the proxy to also allow CONNECT for port 9418, which is the port used by git.
Once they have appropriately configured the proxy, you should then be able to use tools like netcat-openbsd or socat to connect through.
My problem is that I am a student and I can't get around this because I can't reach out to the administrator. I don't know what to do, as I am still stuck looking for an answer.
You added the heroku remote using this URL git#heroku.com:myblog.git. This was probably configured by the heroku create command.
When you push to this remote, it is done via SSH. And this is exactly what the error message indicates: that you (or git) tried to ssh to heroku.com, but couldn't because of your firewall (probably) denied that. With your git push heroku master command, you are not pushing to Github, but to the git repository at Heroku. To push your stuff to Github, you need to git push origin master and use either ssh or http for the transport. The git:// protocol itself does not support pushing changesets but is an unauthenticated re-only protocol.
Currently, Heroku seems to only allow the SSH transport for its git repos and there don't seem to be any direct hooks on Github (see Push from github to heroku without downloading repo). This means to publish your apps on Heroku, you need to be able to push to heroku.com via SSH from your local host.
You can also push to https://cloudhead#github.com/cloudhead/dorothy.git (note the username in the url).
When you push to this remote, it is done via SSH. The error you are getting is because the client could not connect via SSH, most likely because you are behind some type of firewall that is preventing the connection. I used to have this same problem when trying to push to Heroku from work.
My suggestion would be for you to develop locally and then go to some public hotspot to push the changes to Heroku (like a Starbucks).

Resources