Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Unhandled error event #356

Closed
digicasi opened this issue Mar 11, 2016 · 6 comments
Closed

Unhandled error event #356

digicasi opened this issue Mar 11, 2016 · 6 comments

Comments

@digicasi
Copy link

This is the error I'm seeing when trying to look up a user:

2016-03-11T15:08:57.94+0100 [App/0] ERR events.js:141
2016-03-11T15:08:57.94+0100 [App/0] ERR throw er; // Unhandled 'error' event
2016-03-11T15:08:57.94+0100 [App/0] ERR ^
2016-03-11T15:08:57.94+0100 [App/0] ERR Error: getaddrinfo ENOTFOUND company.com:636
2016-03-11T15:08:57.94+0100 [App/0] ERR at errnoException (dns.js:26:10)
2016-03-11T15:08:57.94+0100 [App/0] ERR at GetAddrInfoReqWrap.onlookup as
oncomplete

using node v4.4.0, ldapjs 1.0.0.

I suspect that the ldap server is not accessible, but this shouldn't result in an unhandled error event, should it?
Thanks

@antonfisher
Copy link

I do not think it is an good idea, but you could use empty handler for ignore errors as workaround:

var client = ldap.createClient(opts);
client.on('error', function(){});

Or handle any other errors here and ignore only ENOTFOUND.

@sebaplaza
Copy link

This bug still persists in 2018 (version 1.0.2)

What happened with #433 bugfix ?

@KaiWilke
Copy link

KaiWilke commented Nov 5, 2018

I think this problem should be considered as a documentation bug, since the outlined examples on http://ldapjs.org/client.html do not explain how to securely setup a ldap connection...

// Define LDAP client connection setting

var ldap_client_object = {
	url: 'ldap://192.168.0.1:389/',
	connectTimeout: 2000,
	timeout: 5000,
};

// Create LDAP client connection 

var ldap_client = ldap.createClient( ldap_client_object );

// Register a LDAP client connection "error" handler

ldap_client.on( 'error', function( err ) {

	// The LDAP client connection has generated an error...

});

// Register a LDAP client connection "connectTimeout" handler

ldap_client.on( 'connectTimeout', function( err ) { 

	// The ldap connection attempt has been timed out...

});

// Register a LDAP client connection "connect" handler

ldap_client.on( 'connect', function( ) {

	// The ldap connection is ready to use. Place your subsequent ldapjs code here...

});

HTH and Cheers, Kai

@tastypackets
Copy link

I think @KaiWilke is right, this looks like a documentation issue. The library has pretty poor documentation and I believe a lot of this is from the author expecting users to already have a good understanding / experience working with LDAP.

Unfortunately looks at the lack of attention from the maintainer and open PRs I don't see it worth updating the docs, because they will likely never get merged.

@jsumners
Copy link
Member

It sounds like you are missing a client.on('error', handler). I do believe this could be better described in the documentation. A PR would be very welcome.

@jsumners
Copy link
Member

👋

On February 22, 2023, we released version 3 of this library. As a result, we are closing this issue/pull request.

Please see issue #839 for more information, including how to proceed if you feel this closure is in error.

@ldapjs ldapjs locked as resolved and limited conversation to collaborators Feb 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants