Using Google CloudSQL, getting "connect ECONNREFUSED 127.0.0.1:3306"
Asked Answered
F

2

7

I'm trying my best to learn Google's Cloud Platform. They have a CloudSQL offering, which I'm learning via this NodeJS tutorial. Everything worked great until I deployed to their appspot server, at which point I got the following error:

connect ECONNREFUSED 127.0.0.1:3306

I've looked all through the NodeJS project and don't see anything in it or the Cloud Console that is referencing localhost or 127.0.0.1. Googling the error hasn't helped thus far. Any ideas?

Forensics answered 12/1, 2017 at 0:8 Comment(1)
What do you have in config.json and app.yaml?Lombardi
F
3

I couldn't get this thing fixed when running on server but using this files I was able to read/write from local and production, now im using this connection strings in my own app

https://cloud.google.com/appengine/docs/flexible/nodejs/using-cloud-sql https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/appengine/cloudsql

Franklyn answered 23/1, 2017 at 2:24 Comment(0)
S
3

I had a similar issue when deploying the nodejs sample app 2-structured-data

The reason why the error occurred is that the NODE_ENV environment variable was not passed to the config file that is used to check if node should use a socket for connecting to mysql

You can fix it by adding 'NODE_ENV' in the file config.js :

.env([
 ...
'NODE_ENV'])
Sterne answered 15/2, 2017 at 8:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.