node-activedirectory icon indicating copy to clipboard operation
node-activedirectory copied to clipboard

TypeError: Cannot convert undefined or null to object

Open lfcastilhos opened this issue 2 years ago • 8 comments

Team, recompile my PCF code from 22/2/2023 and I got the error below. Nothing was changed in my code, except redeploy and package update. Also I see ldapjs was updated to version 3.0.0. Anyone having same issue?

/home/vcap/deps/0/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/vcap/deps/0/node_modules/activedirectory/lib/activedirectory.js:416:5) at CorkedEmitter.emit (node:events:513:28) at CorkedEmitter.emit (/home/vcap/deps/0/node_modules/ldapjs/lib/corked_emitter.js:44:33) at sendResult (/home/vcap/deps/0/node_modules/ldapjs/lib/client/client.js:1233:22) at messageCallback (/home/vcap/deps/0/node_modules/ldapjs/lib/client/client.js:1253:14) at Parser.onMessage (/home/vcap/deps/0/node_modules/ldapjs/lib/client/client.js:919:14) at Parser.emit (node:events:513:28) at Parser.write (/home/vcap/deps/0/node_modules/ldapjs/lib/messages/parser.js:135:8) at TLSSocket.onData (/home/vcap/deps/0/node_modules/ldapjs/lib/client/client.js:875:22) at TLSSocket.emit (node:events:513:28) Node.js v18.12.11

lfcastilhos avatar Feb 23 '23 19:02 lfcastilhos

No issues using ldapjs 2.3.3. looks like it's incompatible with ldapjs 3.0.0.;

lfcastilhos avatar Feb 23 '23 22:02 lfcastilhos

Indeed, adding an override in package.json fixes the issue for now:

  "overrides": {
    "activedirectory": {
      "ldapjs": "2.3.3"
    }
  }

andreeib avatar Feb 24 '23 19:02 andreeib

Hi,, y added the override from adreeib, but still the `errror..!!

`{ "dependencies": { "activedirectory": "^0.7.2" }

,"overrides": {
  "activedirectory": {
     "ldapjs": "2.3.3"
   }

} }`

OzukaruCid avatar May 18 '23 00:05 OzukaruCid

it's work now,, i'm sorry still learning..

OzukaruCid avatar May 24 '23 19:05 OzukaruCid

I'm having the same issue, except that mine is persistent even after applying the fixes suggested here and in #60. The code that generates the error is

ad.findUser(username, (err, user) => {
  console.log('something');
  if (err) {
    console.log('ERROR: ' + JSON.stringify(err));
    return;
  }

  if (user) {
    console.log('User: ' + JSON.stringify(user));
  } else {
    console.log('User: ' + username + ' not found.');
  }
});

And my updated package.json

...
  "dependencies": {
    "activedirectory": "^0.7.2",
    "cors": "^2.8.5",
    "express": "^4.18.2",
    "moment": "^2.29.4",
    "pg": "^8.11.3"
  },
  "overrides": {
    "activedirectory": {
      "ldapjs": "2.3.3"
    }
  }

I get the same exact error as previous comments. The node server is running in portainer and the container has been destroyed and recreated. I have also rebooted the physical server with no effect. Commenting out the affected line in activedirectory.js bypasses the fatal error, but is unable to find the user. Any suggestions? Thanks!

willcallender avatar Oct 24 '23 16:10 willcallender

Hello @willcallender I have been getting the same issue in the last 2 weeks and I have not solution for this. I started change implementation to use ldapts library. If you want some help to change it I can help you ;)

joaopenas avatar Oct 27 '23 08:10 joaopenas

Hola a todos:

La implementación de ldap en mi proyecto es muy básico... tuve el mismo problema y estuve a punto de desistir pero instale activedirectory2... Y con eso quedó resuelto...

Saludos

El vie., 27 oct 2023 3:55 a. m., João Penas @.***> escribió:

Hello @willcallender https://github.com/willcallender I have been getting the same issue in the last 2 weeks and I have not solution for this. I started change implementation to use ldapts library. If you want some help to change it I can help you ;)

— Reply to this email directly, view it on GitHub https://github.com/gheeres/node-activedirectory/issues/246#issuecomment-1782549566, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKFFZCE26AKS7G6VKZ4QVQTYBNZJPAVCNFSM6AAAAAAVGBEDRKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBSGU2DSNJWGY . You are receiving this because you commented.Message ID: @.***>

OzukaruCid avatar Oct 27 '23 16:10 OzukaruCid

@OzukaruCid that worked immediately! Thank you!

willcallender avatar Oct 27 '23 17:10 willcallender