RocketChat / RocketChat/Rocket.Chat

LDAP import of users fails "Cannot read property 'replace' of undefined"

Open
#16,549 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: authentication
Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

I having a working server with about 450 users... but one or two new users will not import from LDAP and why I try to import while watching the logs I get the following error:

rocketchat[30634]: Exception in callback of async function: TypeError: Cannot read property 'replace' of undefined
rocketchat[30634]:     at module.exports (/opt/Rocket.Chat/programs/server/npm/node_modules/limax/lib/limax.js:18:15)
rocketchat[30634]:     at slug (app/ldap/server/sync.js:23:9)
rocketchat[30634]:     at ldapUsers.forEach.ldapUser (app/ldap/server/sync.js:307:16)
rocketchat[30634]:     at Array.forEach (<anonymous>)
rocketchat[30634]:     at ldap.searchUsersSync.Meteor.bindEnvironment (app/ldap/server/sync.js:294:13)
rocketchat[30634]:     at runWithEnvironment (packages/meteor.js:1356:24)

The server is running on Ubuntu and has the following versions:

rocketchat[30634]: +------------------------------------------------------------+
rocketchat[30634]: |                       SERVER RUNNING                       |
rocketchat[30634]: +------------------------------------------------------------+
rocketchat[30634]: |                                                            |
rocketchat[30634]: |  Rocket.Chat Version: 1.1.2                                |
rocketchat[30634]: |       NodeJS Version: 8.11.3 - x64                         |
rocketchat[30634]: |      MongoDB Version: 3.4.21                               |
rocketchat[30634]: |       MongoDB Engine: mmapv1                               |
rocketchat[30634]: |             Platform: linux                                |
rocketchat[30634]: |         Process Port: 3000                                 |
rocketchat[30634]: |             Site URL: https://rocketchat.xxxxxxxxxxxx.com  |
rocketchat[30634]: |     ReplicaSet OpLog: Enabled                              |
rocketchat[30634]: |          Commit Hash: aece97e1a0                           |
rocketchat[30634]: |        Commit Branch: HEAD                                 |
rocketchat[30634]: |                                                            |
rocketchat[30634]: +------------------------------------------------------------+

This is syncing against a Windows 2008 R2 Active Directory server. Any ideas on what can be done to troubleshoot more and find out why my LDAP sync is failing all the time now?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the stack trace in app/ldap/server/sync.js, especially the slug call at line 23 and LDAP user processing around lines 294-307. Reproduce an import involving the affected users and inspect which value reaches limax before replace is called. Done means LDAP imports complete without this TypeError and the cause of the missing value is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
authentication, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.