question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use client.starttls()

See original GitHub issue

I am having a little trouble figuring out how to use the client starttls() function. I am creating the client this way:

client = ldap.createClient({
    url: config.ldap.url
});

The client is created correctly and upon calling the starttls function as

client.starttls({}, function(err) {
    console.log('inside the starttls's callback');
});

However, the callback function never gets called. I get the error : [TypeError: Object.keys called on non-object]. In the Node.js TLS documentation it mentions that on connecting, if the certificate authority is left blank it will default to the system certificates, and I was assuming that this would act in the same way. If there were any thoughts on what is going wrong here, that would be great.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
shob0commented, Jul 4, 2017

Please update the documentation as well that controls parameter is not optional.

1reaction
lukelafountainecommented, Dec 14, 2015

Sorry for the delay. I haven’t been working on this for this past week. Here is the stack trace:

TypeError: Object.keys called on non-object
      at Function.keys (native)
      at wrapper (/usr/src/app/node_modules/ldapjs/node_modules/once/node_modules/wrappy/wrappy.js:27:14)
      at Client.starttls (/usr/src/app/node_modules/ldapjs/lib/client/client.js:880:14)
      at AuthenticationHelper.validateToken (/usr/src/app/helpers/authentication.js:97:12)
      at Server.AuthenticationCheck.checkAuth (/usr/src/app/middlewares/authenticationCheck.js:25:14)
      at next (/usr/src/app/node_modules/restify/lib/server.js:906:30)
      at f (/usr/src/app/node_modules/restify/node_modules/once/once.js:17:25)
      at b (domain.js:183:18)
      at Domain.run (domain.js:123:23)
      at Server._run (/usr/src/app/node_modules/restify/lib/server.js:959:7)
      at Server._handle (/usr/src/app/node_modules/restify/lib/server.js:719:14)
      at Server.onRequest (/usr/src/app/node_modules/restify/lib/server.js:326:14)
      at Server.emit (events.js:98:17)
      at HTTPParser.parser.onIncoming (http.js:2109:12)
      at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:122:23)
      at CleartextStream.socket.ondata (http.js:1967:22)

After some further looking, it appears that the controls parameter is required. I was leaving that out as optional, so it was trying to use the callback as the controls. After that, I passed in an empty object for the controls, and apparently it requires the controls to be an array so passing in an empty array works. That might be something helpful to have in the docs or have some type checking on the controls.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is StartTLS? - SendGrid
StartTLS is a protocol command used to inform the email server that the email client wants to upgrade from an insecure connection to...
Read more >
What is StartTLS and how can it be tested? - IONOS
The StartTLS command can be used to initiate encrypted e-mail communication based on the TLS protocol. This provides high flexibility but ...
Read more >
SSL, TLS, and STARTTLS - Fastmail Help
This is an informational page about the history of SSL, TLS, and STARTTLS and the ... All clients were expected to move over...
Read more >
STARTTLS vs SSL vs TLS Explained in 5 Minutes | Mailtrap Blog
How do TLS/SSL and STARTTLS work? ... It's used to tell an email server that an email client (such as Gmail, Outlook, etc.) ......
Read more >
What Are SSL, TLS, & STARTTLS Email Encryption? - SparkPost
STARTTLS is an email protocol command that tells an email server that an email client, including an email client running in a web...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found