Thursday, September 27, 2018

[google-cloud-sql-discuss] Cloud Function postgresDemo is working?

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

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/e324d77c-59d4-4815-ae90-204cc48a8120%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment