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.

Unbind not working with node 10

See original GitHub issue

When I try to use ldapjs client.unbind with node 10.0.0 (or 10.4.0) it does not work and the callback of unbind is never called. I debugged and it seems something in _sendSocket stops working, the function messageCallback is never called. While debugging it worked sometimes and the UnbindResponse was received successfully, but most of the time it didn’t work, so I was wondering if it might be some timing issue, as while debugging everything runs slower/stepped.

The last trace log I see is:

{"name":"ldapjs","component":"client","hostname":"abc","pid":60921,"clazz":"Client","ldap_id":"6__ldaps://ldap.domain.net","level":10,"msg":"sending request {\"messageID\":3,\"protocolOp\":\"UnbindRequest\",\"controls\":[]}","time":"2018-06-07T10:39:44.165Z","v":0}

The code is

            client.search(
                'ou=domain,dc=sub,dc=net',
                opts, (err, res) => {
                    if (err) {
                        cb(err, null);
                        return;
                    }
                    res.on(
                        'searchEntry', entry => {
                            if (entry.object.hasOwnProperty('mail')) {
                                retrievedUsers[entry.object.uid] = entry.object;
                            }
                        }
                    );
                    res.on(
                        'error', err => {
                            cb(err, null);
                            client.unbind(
                                err => {
                                    if (err) {
                                        logger.error(err);
                                    }
                                }
                            );
                        }
                    );
                    res.on(
                        'end', () => {
                            client.unbind(
                                err => { // << --- never called
                                    cb(err, retrievedUsers);
                                }
                            );
                        }
                    );
                }
            );

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
jgeurtscommented, Dec 10, 2018

@purplemana It’s fixed with https://www.npmjs.com/package/ldapts, if you want to give that a go.

5reactions
hwkdcommented, Feb 16, 2019

@jgeurts I just switched to using ldapts package instead. Ended up producing better code and easier to test and works with node 11.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unbinding events in Node.js - Stack Overflow
My question is, is there any way to remove/replace a callback once bound? Or is the only approach to bind a proxy callback...
Read more >
jQuery bind/unbind not working on firefox or in some other ...
So, your jQuery bind is working OK on all browsers and not in firefox? At least in my case, it worked on chrome...
Read more >
How to unbind “hover” event using JQuery? - GeeksforGeeks
Approach: Select the element whose Hover effect needs to be unbinded.(Make sure Hover effect should be added by JQuery only, Hover effect added ......
Read more >
Unbind Request Received starting IP-DLC conection Event ID ...
I have My HOSTSYS connection change from ACTIVE to PENDING in a loop. IP-DLC connection was working until MS11-082 was installed.
Read more >
ldapjs Client API
If a logger is supplied that does not have such a method, then a shim version is ... Node.js will print a stack...
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