LDAP Connection error

See original GitHub issue

Hello,

I do my connection like this

const client = ldap.createClient({
            url: `ldap://url:389`,
            reconnect: true
        });

        client.bind(_this.options.genericEmail, _this.options.genericPassword, err => {
            if (err) {
                callback(err);
            }
        });

And unbind after a search.

client.unbind( err => {
                        if (err) {
                            console.log(err);
                        }
                    });

But after a while on the development server, if it tries to connect again, I get this error and breaks the node server. I am running this application on a kubernetes environment.

events.js:167
--
  | throw er; // Unhandled 'error' event
  | ^
  |  
  | Error: read ECONNRESET
  | at TCP.onStreamRead (internal/stream_base_commons.js:111:27)
  | Emitted 'error' event at:
  | at Socket.onSocketError (/usr/src/app/node_modules/ldapjs/lib/client/client.js:1169:12)
  | at Socket.emit (events.js:182:13)
  | at emitErrorNT (internal/streams/destroy.js:82:8)
  | at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
  | at process._tickCallback (internal/process/next_tick.js:63:19)

Please help me fix this error.

Thank you.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:22 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
tastypacketscommented, Jan 9, 2019

I think this is the timeout error, I can’t test your code right now since my desktop is updating to F29 but should be able to later today.

In the meantime you can add a listener for the errors, so they hopefully won’t crash your application. Here is an example of listening for errors on the client.

// Return errors
client.on('error', error => {
    // Do something with the error
});
3reactions
var-karcommented, Jan 10, 2019

@tastypackets Thank you so much for detailed testing and explanation. Looks like switching to ldapts is the best option, and looks like no one maintains this code base. I will leave this open if at all someone wants to pick it up in the future. I would love to contribute, but my knowledge in LDAP is very very limited.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting LDAP connection issues - IBM
This message communicates that an error occurred during a connection attempt to the LDAP server, which might be due to an incorrect Cloud...
Read more >
LDAP Connection Error - Stack Overflow
Try the following: If your LDAP server is AD then you must perform a bind on the connection since AD doesn't allow anonymous...
Read more >
Troubleshoot LDAP over SSL connection problems
Troubleshoot LDAP over SSL connection problems · Step 1: Verify the Server Authentication certificate · Step 2: Verify the Client Authentication ...
Read more >
LDAP connection error - Support and Troubleshooting
User was unable to access the instance because the LDAP IP connectivity that was configured from the instance was unsuccessful. When a Test...
Read more >
"Failed to connect to LDAP server" when trying to ... - ERROR
​This issue occurs if either SSL certificate that is added to cacerts on Informatica server or LDAP server is incorrectly configured to default...
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