Cloud Function postgresDemo is working?

714 views
Skip to first unread message

Emerson Moraes

unread,
Sep 27, 2018, 11:29:39 PM9/27/18
to Google Cloud SQL discuss
Hi!

I'm trying to deploy postgresDemo function from node.js samples.
But i'm not having success on get connection to my Cloud SQL instance.

I used the following command to publish the function: gcloud beta functions deploy postgresDemo --runtime nodejs8 --env-vars-file env.yaml --trigger-http

I added console log to see if all needed env vars are beeing filled correctly and it's fine. But when I try to create the pg.Pool, i have the following error:

Error: connect ECONNREFUSED 127.0.0.1:5432\n at Object._errnoException (util.js:1022:11)\n at _exceptionWithHostPort (util.js:1044:20)\n at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)\n code: 'ECONNREFUSED',\n errno: 'ECONNREFUSED',\n syscall: 'connect',\n address: '127.0.0.1',\n port: 5432

My App Engine Java application is working with this Cloud SQL instance. But in node cloud function i'm not havind success with the connection.

Here are my params only omitting user and password:

max: 1, user: 'username', password: 'password', database: 'appengine_helloworld_db', socketPath: '/cloudsql/hello-world-4736435:southamerica-east1:hello-world-postgis-sp'

Thank You,

Emerson Leite de Moraes

Katayoon (Cloud Platform Support)

unread,
Oct 2, 2018, 8:42:51 AM10/2/18
to Google Cloud SQL discuss
Hi Emerson,

I reproduced the issue by running the sample code and created a report in the Issue Tracker. You may follow the issue report thread for further updates.
Reply all
Reply to author
Forward
0 new messages