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)
I was upgrading an old project to current versions of node and modules. I ended up with
ldapjsversion 3.0.7 which causes an error when getting user groups viaad.getGroupMembershipForUserThe 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: