Google Cloud SQL + Heroku - heroku

Here is error message that I got!
2014-03-13T08:30:21.010764+00:00 heroku[web.1]: Starting process with command `node dbserver.js`
2014-03-13T08:30:22.485293+00:00 app[web.1]: listening on 14218
2014-03-13T08:30:22.486771+00:00 app[web.1]: lo 127.0.0.1
2014-03-13T08:30:22.551389+00:00 app[web.1]:
2014-03-13T08:30:22.554354+00:00 app[web.1]: at Protocol.end (/app/node_modules/mysql/lib/protocol/Protocol.js:78:13)
2014-03-13T08:30:22.554354+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/mysql/lib/Connection.js:78:28)
2014-03-13T08:30:22.554354+00:00 app[web.1]: Error: Connection lost: The server closed the connection.
2014-03-13T08:30:22.554354+00:00 app[web.1]: at Socket.EventEmitter.emit (events.js:117:20)
2014-03-13T08:30:22.554354+00:00 app[web.1]: at _stream_readable.js:920:16
2014-03-13T08:30:22.554354+00:00 app[web.1]: at process._tickCallback (node.js:415:13)
2014-03-13T08:30:24.327286+00:00 heroku[web.1]: Process exited with status 8
When I test this locally (with foreman or without), and it works!
I have added my IP address in Authorized Networks for Google Cloud SQL,
and as well as my applications's IP address.
I have used http://www.hcidata.info/host2ip.cgi to find out my web app's IP address.
Can anyone had same experience?

Your problem may be similar to the one in this question:
Your problem may be that Cloud SQL is not allowing your Dyno's IP address.
Because the Heroku dyno grid is dynamic in nature, the IP address that a given dyno will be assigned over time will be both dynamic and unpredictable.
As mentioned in the other question, you can use a proxy Heroku add-on that would give you a static IP.
A workaround can be to whitelist 0.0.0.0/0 (all possible IP addresses) within your Cloud SQL instance.
If you do so, I highly recommend requiring SSL for your database connection.

Related

Error: connection refused: localtunnel.me:undefined (check your firewall settings)

I'm trying to set up localtunnel on Ubuntu, but I keep getting the error :
your url is: undefined
/usr/local/lib/node_modules/localtunnel/bin/client:58
throw err;
^
Error: connection refused: localtunnel.me:undefined (check your firewall settings)
at Socket.<anonymous> (/usr/local/lib/node_modules/localtunnel/lib/TunnelCluster.js:47:32)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at emitErrorNT (net.js:1256:8)
at nextTickCallbackWith2Args (node.js:441:9)
at process._tickCallback (node.js:355:17)
I am using Xampp. What could be the issue?
Thank you all.
In ubuntu :
sudo ufw disable
Use the above command to disable the firewall
and create your local tunnel using:
lt --port 8000
Try running it with sudo. I had the same issue while executing as the normal user but running it with sudo helped out. You can also try running it as www-data
After reading this whole issue I can conclude It is not your pc's fault, but the localtunnel server is under heavy load. You should try again in some time.

Faraday::ConnectionFailed (connection refused: :80)

I have created REST API in ruby on rails and for api calling I have used
Faraday as a REST client. my application is working totally fine on localhost:3000.
but when I deployed it to heroku it giving me an error
Faraday::ConnectionFailed (connection refused: :80)
May be you should try on port 443.
There should be a .env file in your project which will be holding the port number . You need to configure it and point it to the port where heroku is using .

getaddrinfo: No addre ss associated with hostname (SocketError)

I need help. I have trouble when I try to push sources to exist repository on my gitlab hosting. When I do
ssh -vT git#git.host.org
or
git push -u origin master #in repository folder
I see
/usr/local/lib/ruby/2.0.0/net/http.rb:878:in `initialize': getaddrinfo: No addre
ss associated with hostname (SocketError)
from /usr/local/lib/ruby/2.0.0/net/http.rb:878:in `open'
from /usr/local/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
from /usr/local/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
from /usr/local/lib/ruby/2.0.0/net/http.rb:877:in `connect'
from /usr/local/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
from /usr/local/lib/ruby/2.0.0/net/http.rb:851:in `start'
from /home/git/gitlab-shell/lib/gitlab_net.rb:62:in `get'
from /home/git/gitlab-shell/lib/gitlab_net.rb:24:in `discover'
from /home/git/gitlab-shell/lib/gitlab_shell.rb:77:in `user'
from /home/git/gitlab-shell/lib/gitlab_shell.rb:82:in `username'
from /home/git/gitlab-shell/lib/gitlab_shell.rb:36:in `exec'
How can I solve it? Thanks.
Not sure if you're using gitlab/gitlabhq and getting this error. But I got this error when using gitlab. In my config.yml in /home/git/gitlab-shell/config.yml i had typed my gitlab_url wrong.
In addition to #Jerinaw answer, these might be the reasons-
Check if remotes are correct using remote -v
Check your host credentials
Check ssh key
Assuming the Network access to git.host.org is given:
getaddrinfo: No addre
ss associated with hostname (SocketError)
means that to your DNS Name git.host.org there is no corresponding address which can be resolved.
you can try nslookup your host:
$nslookup git.host.org
it should give you a adress corresponding to that host otherwise your server doesnt know where to connect. But you will probably not. If you want to fix that only for your server you can put in /etc/hosts something like
192.168.1.100 git.host.org
where 192.168.1.100 must be the correct address to your remote server.
Or you can use the ip address in the first place.

heroku pg:psql not working

I tried to connect to the Postgres database for my app on heroku by running the command "heroku pg:psql" and got the following error message:
psql: could not connect to server: Connection timed out (0x0000274C/10060)
Is the server running on host "URL.com"(IP address) and accepting
TCP/IP connections on port 5432?
I also tried to connect using Pgadmin and get the error:
Server doesn't listen. Is the server running on host "URL.com" (IP address) and accepting
TCP/IP connections on port 5432?
Can anyone tell me how to fix these errors and correctly connect to my database.
Thanks in advance!
Try this:
heroku pg:psql DATABASE_URL
As started to hint already using DATABASE_URL there are few more things to consider.
If you have multiple apps in Heroku it is always good to specify to what app you want to connect to where DB is added. Same applies if you have multiple databases to specify DB name (if it is something else than default DATABASE_URL).
Some examples how to connect:
-- Defining to what DB and app you want to connect to:
heroku pg:psql [lower case generated name] -a myapp
heroku pg:psql [lower case generated name] --app myapp
heroku pg:psql HEROKU_POSTGRESQL_[upper case generated name]_URL -a myapp
-- This will fall back to default DATABASE_URL part of your app:
heroku pg:psql -a myapp
Also to keep in mind as said here https://devcenter.heroku.com/articles/heroku-local#copy-heroku-config-vars-to-your-local-env-file:
Keep in mind that your deployed production app may be connecting to
different services than your local development app. For example, your
deployed production app might have a DATABASE_URL config var that
references a Heroku Postgres database, but your local app might have a
DATABASE_URL variable in the .env file that references your local
installation of Postgres.
Heroku guideline – https://devcenter.heroku.com/articles/heroku-postgresql#pg-psql (but it explains little about multi-database and multi-apps cases).
Heroku guideline for connecting externally - https://devcenter.heroku.com/articles/connecting-to-heroku-postgres-databases-from-outside-of-heroku
This answer might be silly, but it happened to me before. The internet connection I was in is blocking the connection on that port.

Getting error 'Excon nonblock is not supported by your OpenSSL::SSL::SSLSocket' (Heroku)

When trying to push my app to Heroku, it is hanging and I get this message:
ssh: connect to host heroku.com port 22: Operation timed out
When running:
heroku status
I am getting the error:
Excon nonblock is not supported by your OpenSSL::SSL::SSLSocket
Does anyone know what this means and how I can fix it?
I figured out the problem. My company has blocked a ton of stuff so it has something to do with that. When I tried using my phone as a wifi hotspot it worked fine so it has something to do with my network connection at work.

Resources