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

Strict mode problem

Open Wesley-Alves opened this issue 5 years ago • 2 comments

Hello there is a problem with this library when using strict mode.

(node:16368) UnhandledPromiseRejectionWarning: TypeError: Cannot set property value of [object Object] which has only a getter at PagedResultsControl.Control (ldapjs\lib\controls\control.js:29:13) at new PagedResultsControl (Cdapjs\lib\controls\paged_results_control.js:31:11)

I simulated what the library does here

Basically in strict mode you cannot set a property that does not have a setter if you use Object.defineProperty.

I can't provide an example usage because I don't use this library directly, but I use another library that has dependence on it, and I can't use my application if I enable strict mode

Wesley-Alves avatar Dec 30 '19 01:12 Wesley-Alves

Would you be willing to send a PR to resolve this?

jsumners avatar Jan 08 '20 16:01 jsumners

Edit: See PR #812 for a better solution.


Here is the diff that solved my problem:

diff --git a/node_modules/ldapjs/lib/controls/control.js b/node_modules/ldapjs/lib/controls/control.js
index 188a8bd..ac0b67f 100644
--- a/node_modules/ldapjs/lib/controls/control.js
+++ b/node_modules/ldapjs/lib/controls/control.js
@@ -23,7 +23,7 @@ function Control (options) {
 
   this.type = options.type || ''
   this.criticality = options.critical || options.criticality || false
-  this.value = options.value || null
+  // this.value = options.value || null
 }
 Object.defineProperties(Control.prototype, {
   json: {

sastan avatar Jul 04 '22 10:07 sastan

👋

On February 22, 2023, we released version 3 of this library. As a result, we are closing this issue/pull request.

Please see issue #839 for more information, including how to proceed if you feel this closure is in error.

jsumners avatar Feb 22 '23 19:02 jsumners