question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unhandled 'error' event thrown when the connection password doesn't match

See original GitHub issue

When I connect to an existing database with the connect username but the wrong password, I got an unhandled exception using the following code. The parameter err is set, but the exception is still thrown.

pg.connect(dbURL, function(err, client, done) {
  if(err) {
    return console.error('error fetching client from pool', err);
  }
  client.query('SELECT $1::int AS number', ['1'], function(err, result) {
    //call `done()` to release the client back to the pool
    done();

    if(err) {
      return console.error('error running query', err);
    }
    console.log(result.rows[0].number);
    //output: 1
    client.end();
  });
});

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:38 (20 by maintainers)

github_iconTop GitHub Comments

1reaction
vitaly-tcommented, May 23, 2015

+1000

The same error is thrown when we pass an invalid connection:

pg.connect("bla-bla");

Other than that, it is 100% reproducible for me, for both invalid user name and invalid password.

It’s been way too long for such a critical issue to just sit here and nothing being done about it. Very frustrating.

I have a number of tests now for pg-promise commented out because of this error, which just kills jasmine framework that I’m using for testing.

Should have been labelled as a bug, at least, as it definitely is.

0reactions
charmandercommented, Dec 21, 2016

Upgrade to pg-pool ≥ 1.6.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix "The sign-in name or password does not match one in the ...
Here are the possible causes and solutions: Your user name or password could be wrong (Obviously!). Check if you are able to log...
Read more >
Solved: Re: Failed Qlik Sense Enterprise on Windows August...
Finally when all of that failed I changed the qliksenserepository password and the errors in event logs still persist. Main errors below, repeat...
Read more >
Initial setup fails: api pod crash-loop - Self Hosted Retool
The api pod gives the following error message: ... 14:34:59.670 UTC [111] DETAIL: Password does not match for user "retool_internal_user".
Read more >
Error handling - Apollo GraphQL Docs
A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ...
Read more >
NodeJS/mySQL - ER_ACCESS_DENIED_ERROR Access ...
I have the same problem, I solved it by changing the password to empty string. var mysql = require('mysql'); var connection = mysql....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found