Home > Software engineering >  GAE Connection to SQL: password authentication failed for user 'postgres'
GAE Connection to SQL: password authentication failed for user 'postgres'

Time:05-18

nodejs app on GAE flex deploys correctly, but won't connect to postgres, even though initial knex migration worked and the tables were created. Ive read through the documentation and cant understand how all of the below can be true.

running psql -h [ipaddress] -p 5432 -U postgres mydb and entering the password from my local machine works!

package.json..

"prestart": "npx knex migrate:latest && npx knex seed:run
"start": "NODE_ENV=production npm-run-all build server"

worked! tables were created and seed was run knexfile

production: {
  client: 'postgresql',
  connection: {
    database: DB_PASS,
    user: DB_USER,
    password: DB_PASS,
    host: DB_HOST

  },
  pool: {
    min: 2,
    max: 10
  },
  migrations: {
    directory: './db/migrations',
    tableName: 'knex_migrations'
  },
  seeds: {
    directory: './db/seeds/dev'
  }
}

yaml

runtime: nodejs
env: flex

instance_class: F2

beta_settings:
  cloud_sql_instances: xxxx-00000:us-west1:myinst

env_variables:
  DB_USER: 'postgres'
  DB_PASS: 'mypass'
  DB_NAME: 'myddb'
  DB_HOST: '/cloudsql/xxxx-00000:us-west1:myinst'

handlers:...

IAM

enter image description here

CodePudding user response:

oddly, it was a log only issue. the logs still say user authentication failed, but actually the app was connected.

  • Related