Variable undefined when login with LDAP [Solved]

Hi everyone,

I’m completely newbie with Meteor, so sorry in advance if I’m asking something stupid.

I need to login against a LDAP Server. Doing some Google I’ve discovered typ:accounts-ldap package and its documentation.

The problem came up on the server side. Right now the main.ts code is:

import { Meteor } from 'meteor/meteor';

Meteor.startup(() => {
  // code to run on server at startup
  LDAP_DEFAULTS.url = "ldap://ldap.*************.es";
  LDAP_DEFAULTS.port = 3189

But throws me an error LDAP_DEFAULTS is not defined. Do I need to import something?

Has anyone worked with this package?

Thank you in advance

Looking at the package code, I think you’ll probably need to add:

import { LDAP, LDAP_DEFAULTS } from 'meteor/typ:accounts-ldap';

at the top of your main.ts.

(I assume you’ve done meteor add typ:accounts-ldap in your project?)

import { LDAP, LDAP_DEFAULTS } from 'meteor/typ:accounts-ldap'

Module not found

I’ve checked is installed. I’ve tried too with ‘meteor/accounts-ldap’

Here’s what I did:

meteor create test-ldap
cd test-ldap
meteor npm i
meteor add typ:accounts-ldap
> edited server/main.js - see callout below
// file: server/main.js

import { LDAP_DEFAULTS } from 'meteor/typ:accounts-ldap';


Output from meteor command:

I20180615-13:58:55.123(1)? { url: false,
I20180615-13:58:55.124(1)?   port: '389',
I20180615-13:58:55.124(1)?   dn: false,
I20180615-13:58:55.124(1)?   searchDN: false,
I20180615-13:58:55.125(1)?   searchCredentials: false,
I20180615-13:58:55.125(1)?   createNewUser: true,
I20180615-13:58:55.126(1)?   defaultDomain: false,
I20180615-13:58:55.126(1)?   searchResultsProfileMap: false,
I20180615-13:58:55.127(1)?   base: null,
I20180615-13:58:55.127(1)?   search: '(objectclass=*)',
I20180615-13:58:55.128(1)?   ldapsCertificate: false }

(LDAP is undefined, but as it doesn’t seem to be documented, there isn’t any point importing it.)

You’ll also need to do some casting to any (or define the module) because he’s using Typescript.

Sorry for the delay. I’m seeing others error about modules at startup.

Unable to resolve some modules:

  "@babel/runtime/helpers/interopRequireDefault" in /mnt/c/projects/protocoloMeteor/api/test/main.js (web.browser)
  "@babel/runtime/regenerator" in /mnt/c/projects/protocoloMeteor/api/test/main.js (web.browser)

If you notice problems related to these missing modules, consider running:

  meteor npm install --save @babel/runtime

server/main.ts (2, 31): Cannot find module 'meteor/typ:accounts-ldap'.
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Can't start Mongo server.

I’m going to resolve first these problems, maybe fix everything

I’ve finally found an explanation for the problem. I’m working with Windows Linux Subsystem, using a Symbolic link with my folder in Windows. That’s the problem.

If I do the same working on ‘pure’ linux everything works fine. There’s no mistakes in the code.

Thanks to everyone