Skip to content

LDAPJS 3.x causing errors - need to pin to version 2.x #253

@leejoramo-d51

Description

@leejoramo-d51

I was upgrading an old project to current versions of node and modules. I ended up with ldapjs version 3.0.7 which causes an error when getting user groups via ad.getGroupMembershipForUser

The solution was pin the version in the dependencies of my package.json to use the lastest of the 2.x series via "ldapjs": "^2.3.1"

Here is the error trace I had been seeing:

/home/joramo/projects/activedirectory_test/node_modules/.pnpm/activedirectory@0.7.2/node_modules/activedirectory/lib/activedirectory.js:416
    delete result.controls; // Remove the controls array returned as part of the SearchEntry
    ^

TypeError: Cannot convert undefined or null to object
    at CorkedEmitter.onSearchEntry (/home/joramo/projects/activedirectory_test/node_modules/.pnpm/activedirectory@0.7.2/node_modules/activedirectory/lib/activedirectory.js:416:5)
    at CorkedEmitter.emit (node:events:518:28)
    at CorkedEmitter.emit (/home/joramo/projects/activedirectory_test/node_modules/.pnpm/ldapjs@3.0.7/node_modules/ldapjs/lib/corked_emitter.js:44:33)
    at sendResult (/home/joramo/projects/activedirectory_test/node_modules/.pnpm/ldapjs@3.0.7/node_modules/ldapjs/lib/client/client.js:1239:22)
    at messageCallback (/home/joramo/projects/activedirectory_test/node_modules/.pnpm/ldapjs@3.0.7/node_modules/ldapjs/lib/client/client.js:1259:14)
    at Parser.onMessage (/home/joramo/projects/activedirectory_test/node_modules/.pnpm/ldapjs@3.0.7/node_modules/ldapjs/lib/client/client.js:925:14)
    at Parser.emit (node:events:518:28)
    at Parser.write (/home/joramo/projects/activedirectory_test/node_modules/.pnpm/ldapjs@3.0.7/node_modules/ldapjs/lib/messages/parser.js:135:8)
    at Socket.onData (/home/joramo/projects/activedirectory_test/node_modules/.pnpm/ldapjs@3.0.7/node_modules/ldapjs/lib/client/client.js:875:22)
    at Socket.emit (node:events:518:28)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions