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.

Connection intermittently made, rejects connection with password authentication failure notice

See original GitHub issue

OSX 10.11.4 PG 9.4.8 Using pg module.

var pg = require('pg');
var conString = "postgres://postgres:REDACTED@localhost/testDb";

pg.connect(conString, 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 
  });
});

I get the following error:

error fetching client from pool { error: password authentication failed for user “postgres”

Then if I run this code with node - say - 10-15 times, it’ll work once out of those attempts.

I’ve reinstalled postgres and made sure the passwords match. I tried performing an alter user for the password. I tried killing all open connections with pg_terminate_backend(pid). Still fails. Any help would be appreciated. Everything was working with this prior to upgrading to El Capitan, is El Capitan not supported?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
FarhanAhmad212commented, Aug 23, 2017

it work after adding this host all all 0.0.0.0/0 md5 in pg_hba.conf file.

0reactions
langpavelcommented, Aug 24, 2017

@FarhanAhmad212 This is very bad. You should try more secure way.

Read more comments on GitHub >

github_iconTop Results From Across the Web

You are intermittently prompted for credentials or experience ...
You are intermittently prompted for credentials or experience time-outs when you connect to Authenticated Services. Windows Server 2008 R2 Datacenter ...
Read more >
WiFi Authentication error on Android【SOLVED】| updato.com
The Android Wi-Fi authentication problem manifests when you unsuccessfully try to connect to a Wi-Fi network with the correct password.
Read more >
Git push results in "Authentication Failed" - Stack Overflow
If you enabled two-factor authentication in your GitHub account you won't be able to push via HTTPS using your accounts password.
Read more >
Tips to fix your SSH authentication issues - ARDC Support
If it is not running, the operating system on your instance will "refuse" connection requests. Diagnosis: Login via the VNC console and use...
Read more >
Resolving User Login Authentication Failure Issues
You must log in to Oracle WebLogic Server Administration Console and Fusion Middleware Control with the username and password that you specified for...
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