javascriptnode.jsldapldapjs

Cannot retrive objectName from searchEntry when I update ldapjs to v3


I recently upgraded the package ldapjs from v2 to v3. When I search for a user attribute with searchEntry, I get an empty object, but all others functions worked without a problem, this is my code:

          client.search(adSuffix, searchOptions, async (err: any, res: any) => {
            assert.ifError(err);
            await res.on('searchEntry', async (entry: any) => {
             //
             //this part was working normaly with ldapjs v2
             //
             console.log("entry.objectName ",entry.objectName);
             //but now i get an empty object
            });
          });

Did someone had the same issue ? or know how to fix it ?


Solution

  • I found the solution, I added .pojo to access to the object:

    res.on('searchEntry', async (entry: any) => {
                 console.log('entry: ' + JSON.stringify(entry.pojo.objectName));
    }