Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

socket.socket undefined using TLS on Node 0.12.7 #289

Closed
anthony-o opened this issue Aug 14, 2015 · 11 comments
Closed

socket.socket undefined using TLS on Node 0.12.7 #289

anthony-o opened this issue Aug 14, 2015 · 11 comments

Comments

@anthony-o
Copy link

When trying to connect using ldapjs.createClient({url: 'ldaps://url.to.ldap.tld:636/'}), I'm getting this stack on Node 0.12.7:

TypeError: Cannot read property 'on' of undefined
    at setupSocket (c:\Users\E0234544\Projets\TM4ALL\node_modules\ldapjs\lib\client\client.js:111:14)
    at Client._connect (c:\Users\E0234544\Projets\TM4ALL\node_modules\ldapjs\lib\client\client.js:742:3)
    at new Client (c:\Users\E0234544\Projets\TM4ALL\node_modules\ldapjs\lib\client\client.js:247:22)
    at Object.createClient (c:\Users\E0234544\Projets\TM4ALL\node_modules\ldapjs\lib\client\index.js:60:12)

The code there is:

  // Since tls.socket doesn't emit 'close' events, we must register to receive
  // them on net.socket instead
  var closeSocket = (opts.secure ? socket.socket : socket);
  // On close we have to walk the outstanding messages and go invoke their
  // callback with an error.
  closeSocket.on('close', function onClose(had_err) {

opts.secure equals to true but socket.socket doesn't exist (is undefined).

Moreover, looking at the Nodejs tls.connect() API, I don't understand why a distinction is done between secured (using tls API, and calling socket.socket) and unsecured (using net API and calling directly socket) connections.

I'm using node-ldapjs v0.7.1.

@anthony-o
Copy link
Author

Using latest dev version ("dependencies": {"ldapjs": "mcavage/node-ldapjs#acc1ca8f4314fd9d67561feabc8ce4c235076a5e"}) fixed this issue.

@matthew-b-payne
Copy link

Yes, I have this issue with any of the node 0.12.x builds. okay for 0.10.36

@rochal
Copy link

rochal commented Aug 21, 2015

Hi @mcavage, have you got an ETA to cut new release out of master and push to npm? This issue blocking us a bit as we switched to 0.12.

@pfmooney
Copy link
Contributor

0.8.0 is mostly ready, save for updated documentation.
I have not been able to find time to work on it recently.

@astanciu
Copy link

How were you able to install this on node 0.12. As per Issue #281, didn't think this could be installed...?

@anthony-o
Copy link
Author

I just put "ldapjs": "mcavage/node-ldapjs#acc1ca8f4314fd9d67561feabc8ce4c235076a5e" as an npm dependency for my project in my package.json.

@mstorus
Copy link

mstorus commented Sep 22, 2015

Hi @pfmooney . Thanks for working on this project!
Do you have any estimate on when a new version will be released that includes this fix?

@pfmooney
Copy link
Contributor

I'm working on finishing updates to the documentation.
When that is done, I'll cut the release.

@pfmooney
Copy link
Contributor

1.0.0 has been released with updated dependencies

@umadevisk89
Copy link

I get below error Invalid data, chunk must be a string or buffer, not object
at Socket.write (net.js:696:11)

@jsumners
Copy link
Member

⚠️ This issue has been locked due to age. If you have encountered a recent
problem that seems to be covered by this issue, please open a new issue.

Please include a minimal reproducible example
when opening a new issue.

@ldapjs ldapjs locked as resolved and limited conversation to collaborators Mar 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants