A
A
Anrek2022-02-14 14:37:11
JavaScript
Anrek, 2022-02-14 14:37:11

How to debug an error to understand why the url for the database is incorrect?

Good afternoon!

I'm trying to connect to an App Engine database and compose a URL. This error comes out:

throw new Error('SASL: SCRAM-SERVER-FIRST-MESSAGE: 
client password must be a string')


Where she appears:
const pool = slonik_1.createPool(
`socket:userName:[email protected]/cloudsql/teest-123986:europe-west3:test?db=dbName`
)


I tried to parse the same line like this:

var parse = require('pg-connection-string').parse;
var config = parse(
`socket:userName:[email protected]/cloudsql/teest-123986:europe-west3:test?db=dbName`
)
console.log('config', config)

The result is ok, read as a string:
config [Object: null prototype] {
  db: 'dbName',
  user: 'userName',
  password: 'password',
  port: null,
  host: '/cloudsql/teest-123986:europe-west3:test',
  database: 'dbName',
  client_encoding: undefined
}

Question: how else can you try to get close to the error?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anrek, 2022-02-19
@Anrek

In the end this worked:

socket://${process.env.SQL_USER}:${process.env.SQL_PASSWORD}@${process.env.IP_DB_PRIVATE}?db=${process.env.DB}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question