2

So I just want to create a connection to my LDAP server:

var ldap = require('ldapjs');
var client = ldap.createClient({
  url: 'ldap://192.168.200.35:389'
});

But no matter what I'll input for the url:

TypeError: ldap://192.168.200.35:389 is an invalid LDAP url (scope)

Connecting with the Apache Direct Studio is working fine. I'll also receive a runtime warning:

Module not found: Error: Can't resolve './src/build' in 'C:\...\node_modules\dtrace-provider'

Has anyone a fix for this error?

dewey
  • 809
  • 2
  • 16
  • 47

2 Answers2

2

dtrace-provider doesn't support Windows (and hence ldapjs which is build on top of dtrace also doesn't support Windows OS):

This libusdt-based Node.JS module supports 64 and 32 bit processes on Mac OS X and Solaris-like systems such as illumos or SmartOS. As more platform support is added to libusdt, those platforms will be supported by this module. See libusdt's status at:

Nir Alfasi
  • 53,191
  • 11
  • 86
  • 129
  • Well, I didn't expect that. What alternative to `ldapjs` would you suggest? – dewey Jun 10 '20 at 09:24
  • 1
    I can't recommend any, but the following two seem popular enough to give them a try: https://www.npmjs.com/package/passport-ldapauth and https://www.npmjs.com/package/activedirectory – Nir Alfasi Jun 10 '20 at 10:46
  • The above mentioned two lib as well not working. can you suggest if anything which resolve above issue. – KARTHIKEYAN.A May 17 '22 at 05:21
  • 1
    @KARTHIKEYAN.A I can't recommend any but from microsoft official documentation: https://learn.microsoft.com/en-us/azure/active-directory/develop/tutorial-v2-nodejs-webapp-msal – Nir Alfasi May 18 '22 at 21:51
0

In node_modules/ldapjs/lib/url.js we need to do the following changes, after the changes it working fine.

Error:

parsedURL = new url.URL(urlStr)

Solution:

parsedURL = new url.parse(urlStr)
KARTHIKEYAN.A
  • 18,210
  • 6
  • 124
  • 133