0

I received this error:

/home/user/node_modules/ldapjs/lib/server.js:65
throw new TypeError('Invalid argument type: ' + typeof (argv[i]));
        ^
TypeError: Invalid argument type: undefined
at mergeFunctionArgs (/home/user/node_modules/ldapjs/lib/server.js:65:13)
at Server._mount (/home/user/node_modules/ldapjs/lib/server.js:814:35)
at Server.add (/home/user/node_modules/ldapjs/lib/server.js:500:15)
at Object.<anonymous> (/home/user/workspace/ldap/ldap.js:34:8)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)

when attempting to do the tests on ldapjs guide.

This error pretty much blocks on doing further testing since the service won't start.

10
  • Tried to "fix" the server.js, but for some reason it fails to parse the mentioned row correctly. It always gives the same error, even when attempting to make the error a variable and throw it later. Commented Nov 7, 2012 at 7:48
  • Using Ubuntu 11.10, the ldapjs was installed with 'npm install ldapjs' Commented Nov 7, 2012 at 7:53
  • What is the code you are using? Commented Nov 7, 2012 at 7:57
  • The code is the same than provided in the example ldapjs guide Commented Nov 8, 2012 at 7:07
  • The guide has a lot of snippets, please be more specific Commented Nov 8, 2012 at 8:02

2 Answers 2

1

You are passing pre to ldapjs before it has been assigned the array of functions (I.E. it is undefined at the time). Variable and functions declarations are hoisted to the top, but assignments are not.

Move this

133. var pre = [authorize, loadPasswdFile];

To the top, or at least before you pass it to ldapjs.

The assignment is currently happening on line 133, but you are already passing it on line 34:

34. server.add('ou=users, o=myhost', pre, function(req, res, next) 

Btw, you should be able to see better where errors originate from by setting this at the start of the code:

Error.stackTraceLimit = Infinity;
Sign up to request clarification or add additional context in comments.

Comments

0

My "solution" was to comment out the line whole together. It surely is not the right way to have it fixed, but at least the service starts then.

1 Comment

If someone knows a better way to do this, please add the correct answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.