RocketChat / RocketChat/Rocket.Chat

LDAP user can not login after db update from 4.4 to 5.0

Open
#30,882 5 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

Description:

After db update from 4.4 to 5.0 LDAP user can not login neither to WebUI nor app – got WebUI crash error.

Steps to reproduce:
  1. stop rocketchat
  2. stop mongodb
  3. change mongodb compatibility settings
  4. update mongodb from repos
  5. start mongodb

Also

  • checking LDAP connection from UI works
  • finding LDAP user from UI works
  • local user login works

Also did not help:

  • mongodb export and import after update (with indexes)
  • clear indexes
  • clear banner settings for user
Actual behavior:

Got UI crash error.
Screenshot 2023-11-07 at 20 44 58

Server Setup Information:
  • Version of Rocket.Chat Server: 6.4.5
  • Operating System: Debian 11
  • Deployment Method: Manual installation
  • Number of Running Instances: 1
  • DB Replicaset Oplog: Enabled
  • NodeJS Version: 14.21.2
  • MongoDB Version: 5.0.22 wiredTiger (Single node replica set)
Client Setup Information
  • Desktop App or Browser Version: Safari, Chrome
  • Operating System: macOS, iOS
Additional context

New LDAP users can login

Relevant logs:

{"level":50,"time":"2023-11-08T08:28:45.040Z","pid":995,"hostname":"servername","name":"LDAP Data Converter","err":{"type":"errorClass","message":"Username already exists. [403]","stack":"Error: Username already exists. [403]<br> at AccountsServer.insertUserDoc (packages/accounts-base/accounts_server.js:1206:15)<br> at app/authentication/server/startup/index.js:301:28<br> at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40<br> => awaited here:<br> at Function.Promise.await (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)<br> at AccountsServer.Accounts.insertUserDoc (app/authentication/server/startup/index.js:363:17)<br> at app/importer/server/classes/ImportDataConverter.ts:375:19<br> at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40<br> => awaited here:<br> at Function.Promise.await (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)<br> at app/importer/server/classes/ImportDataConverter.ts:525:18<br> at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40","isClientSafe":true,"error":403,"reason":"Username already exists.","errorType":"Meteor.Error"},"msg":"Username already exists. [403]"}

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 by reproducing the 4.4-to-5.0 MongoDB upgrade and inspect the LDAP login path in app/authentication/server/startup/index.js. Trace the Username already exists error through app/importer/server/classes/ImportDataConverter.ts and AccountsServer.insertUserDoc. Done means existing LDAP users can log in to the WebUI and app after the upgrade without a crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
mongodb, typescript
Domain
authentication, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.