Google Cloud SQL + Heroku
Asked Answered
L

1

7

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?

Liquefacient answered 13/3, 2014 at 8:44 Comment(1)
Can you please write to [email protected] and indicate the full instance name?Erective
S
14

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.

Sandiesandifer answered 24/10, 2014 at 14:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.