I am getting the below error while connecting to LDAP using nodejs in GCP cloud function
Error: TypeError: options (object) required at Object.createClient
Index.js
exports.helloWorld = (event, context) => {
const gcsEvent = event;
var username = ***;
var password = ***;
console.log(`hello world`);
var ldap = require('ldapjs');
var client =ldap.createClient(username, password)({
url: 'LDAP://...'
})
client.bind(username, password, function(error){
if(error){
console.log("error");
}
else{
console.log("Connected to ldap");
}
})
}
Package.json
{
"name": "sample-http",
"version": "0.0.1",
"author": "sang",
"description": "LDAP Binding for node.js",
"dependencies": {
"ldapjs": "^0.7.1"
}
}