0

I am using nodejs firebase functions. I use sequlize to connect to the postgres db.

I tried following the doc https://cloud.google.com/functions/docs/sql to connect to the db from firebase functions, but I am not able to connect. I get this error.

Failed to prune sessions: connect ECONNREFUSED 127.0.0.1:5432

This is the configuration that I use.

{ username: 'postgres',
    password: '*********',
    database: 'testdb',
    host: '/cloudsql/my-project:us-central1:db-instance',
    port: 5432,
    dialect: 'postgres',
    dialectOptions: { ssl: false }}

Any thoughts ?

2
  • 1
    I don't know anything about sequlize, but I'll ask if you're you sure that host string is correct? Something is trying to connect to the local Cloud Functions instance, which is obviously not right. Commented Dec 21, 2018 at 22:12
  • @DougStevensonn thanks for the hint. I got it fixed. Btw the fire base carol was awesome : ) Commented Dec 23, 2018 at 20:33

1 Answer 1

0

My bad. I was also using pg session and it was using a connection string. I guess pg was not able to differentiate the host from the connection string.

After replacing the connection string with a pg pool object, I was able to connect.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.