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.

Uncaught TypeError: net.connect is not a function

See original GitHub issue

I try to use ldapjs in my react app to do user authentification. Everything is installed by npm and is the latest version. I already have openldap as my server. And I import ldapjs into my code:

var ldap = require('ldapjs');
var client = ldap.createClient({
  url: 'ldap://192.168.1.90:389'
})

const baseDN = 'dc=mnw-inc,dc=com'

export function login(username, password) {
  client.bind(rootDN, rootpasswd, function(err, res) {
    // here handle response
  })
}

Run my react app and I got this error in console client.js:1039 Uncaught TypeError: net.connect is not a function at connectSocket (client.js:1039) at Backoff.<anonymous> (client.js:1203) at Backoff../node_modules/events/events.js.EventEmitter.emit (events.js:84) at Backoff../node_modules/backoff/lib/backoff.js.Backoff.onBackoff_ (backoff.js:53) And when I call login function nothing return from bind function. Anyone can help?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Chiffcommented, Feb 4, 2018

got same error, any news about this?

EDIT:

you cant use ‘net’ module on client-side, it must be on server 😃

1reaction
micka753commented, Apr 17, 2018

also caught this error in Vuejs project. Any fixe ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

require('net').connect is not a function - Stack Overflow
Net is node.js (SSR) package and isn't available on the browser since the browser cannot open arbitrary TCP sockets.
Read more >
How to Handle JavaScript Uncaught TypeError: “x” is Not a ...
The Javascript TypeError: "x" is not a function occurs when calling a function on a value or object, which is not actually a...
Read more >
Errors | Node.js v19.3.0 Documentation
Indicates that a provided argument is not an allowable type. For example, passing a function to a parameter which expects a string would...
Read more >
Klemen1337/node-thermal-printer - Gitter
Uncaught TypeError : net.connect is not a function. When I switched var net = require("net"); to var net = require("net-browserify"); on line 10, ......
Read more >
Uncaught TypeError: net.connect is not a function -
Uncaught TypeError : net.connect is not a function ... I try to use ldapjs in my react app to do user authentification. Everything...
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