ldapjs / node-ldapjs

LDAP Client and Server API for node.js
http://ldapjs.org
MIT License
1.61k stars 442 forks source link

Use strict mode to support bundling with rollup #891

Closed passi246 closed 1 year ago

passi246 commented 1 year ago

In our setup, we use Rollup.js to bundle our code into a single file.

Running v3 results in

ldapsearch -x -H ldap://127.0.0.1:1389 -b "ou=example"
ldap_bind: Invalid DN syntax (34)

This can be debugged to

req.name = DN.fromString(req.name)

Above line throws the following error: TypeError: Cannot set property name of [object Object] which has only a getter

Rollup assumes all packages to be in strict mode. To be compatible with rollup, all non strict calls have to be removed.

Best regards.


Update: Previously stated v2 works. This is true using ldapsearch for testing purposes. But in our production system, in combination with keycloak, a similar error occurs at a different location (Control.js). Therefore my previous statement, doesn't hold. Nevertheless would be pretty darn good, if it uses strict mode.

jsumners commented 1 year ago

All of the new modules created for v3 have "use strict" at the start of all of their source files. The code in the ldapjs module has never had it. We will not be adding it to the current code. When things get refactored into separate client and server packages, those packages will be in strict mode.

Additionally, we do not support bundling.