RocketChat / RocketChat/Rocket.Chat
upgrade 6.4.2 to 6.5.0 LDAP /AD User cannot login "msg=Username already exists."
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
after upgrade from 6.4.2 to 6.5.0 LDAP user cannot login.
In the log is see this:
2023-12-07T13:48:15.651Z 50 pid=8 hostname=5b601d333a45 name=LDAP Data Converter err={"type":"errorClass","message":"Username already exists. [403]","stack":"Error: Username already exists. [403]\n at AccountsServer.insertUserDoc (packages/accounts-base/accounts_server.js:1206:15)\n at app/authentication/server/startup/index.js:301:28\n at /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40\n => awaited here:\n at Function.Promise.await (/app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)\n at AccountsServer.Accounts.insertUserDoc (app/authentication/server/startup/index.js:363:17)\n at app/importer/server/classes/ImportDataConverter.ts:375:19\n at /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40\n => awaited here:\n at Function.Promise.await (/app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)\n at app/importer/server/classes/ImportDataConverter.ts:525:18\n at /app/bundle/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]
Steps to reproduce:
- go to docker-compose file change version TAG pull & start
- canot log in to new session
- user is existing and can be looked up
- existing session reconnects fine after update
Expected behavior:
updates where going fine so far ....
could login by LDAP (AD) account afterwards
Actual behavior:
Server Setup Information:
- Version of Rocket.Chat Server: 6.5.0 (from 6.4.2)
- Operating System: Debian buster
- Deployment Method: docker, via portainer stack
- Number of Running Instances: 1
Client Setup Information
- Desktop App or Browser Version: various tired Vivaldi, Firefox, Chrome
- Operating System: macOS, ubuntu 22.04 LTS
Additional context
Relevant logs:
increased logging to debug, redacted domain name
{"level":20,"time":"2023-12-07T14:08:06.564Z","pid":8,"hostname":"5b601d333a45","name":"Callbacks","msg":"Executing callback with id mapLDAPCustomFields for hook mapLDAPUserData"}
{"level":50,"time":"2023-12-07T14:08:06.587Z","pid":8,"hostname":"5b601d333a45","name":"LDAP Data Converter","err":{"type":"errorClass","message":"Email already exists. [403]","stack":"Error: Email already exists. [403]<br> at AccountsServer.insertUserDoc (packages/accounts-base/accounts_server.js:1204:15)<br> at app/authentication/server/startup/index.js:301:28<br> at /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40<br> => awaited here:<br> at Function.Promise.await (/app/bundle/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 /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40<br> => awaited here:<br> at Function.Promise.await (/app/bundle/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 /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40","isClientSafe":true,"error":403,"reason":"Email already exists.","errorType":"Meteor.Error"},"msg":"Email already exists. [403]"}
{"level":20,"time":"2023-12-07T14:08:06.589Z","pid":8,"hostname":"5b601d333a45","name":"LDAP","msg":"Querying user","uniqueId":"746f686f6666"}
{"level":30,"time":"2023-12-07T14:08:06.594Z","pid":8,"hostname":"5b601d333a45","name":"LDAP","section":"Connection","msg":"Disconnecting"}
{"level":20,"time":"2023-12-07T14:08:06.596Z","pid":8,"hostname":"5b601d333a45","name":"Callbacks","msg":"Executing callback with id validateLdapLoginFallback for hook beforeValidateLogin"}
Exception while invoking method login errorClass [Error]: Unrecognized options for login request [400] at packages/accounts-base/accounts_server.js:606:14 at /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40 => awaited here: at Function.Promise.await (/app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12) at packages/accounts-base/accounts_server.js:653:7 at /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40 => awaited here: at Function.Promise.await (/app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12) at packages/meteor.js:367:22 at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1389:31) at packages/ddp-server/livedata_server.js:1818:36 at new Promise (<anonymous>) at Server.applyAsync (packages/ddp-server/livedata_server.js:1817:12) at Server.callAsync (packages/ddp-server/livedata_server.js:1743:17) at app/api/server/v1/misc.ts:622:33 at /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40 => awaited here: at Function.Promise.await (/app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12) at app/api/server/v1/misc.ts:622:17 at /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40 { isClientSafe: true, error: 400, reason: 'Unrecognized options for login request', details: undefined, errorType: 'Meteor.Error' }
{"level":35,"time":"2023-12-07T14:08:06.601Z","pid":8,"hostname":"5b601d333a45","name":"API","method":"POST","url":"/api/v1/method.callAnon/login","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:120.0) Gecko/20100101 Firefox/120.0","length":"170","host":"chat..example.com","referer":"https://chat.example.com/home","remoteIP":"10.25.20.125","status":200,"responseTime":260}
{"level":30,"time":"2023-12-07T14:08:06.605Z","pid":8,"hostname":"5b601d333a45","name":"LDAP","section":"Search","msg":"Closed"}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the LDAP login flow in app/authentication/server/startup/index.js and the importer path in app/importer/server/classes/ImportDataConverter.ts, then inspect the duplicate checks reported from packages/accounts-base/accounts_server.js. Reproduce the 6.4.2-to-6.5.0 upgrade and verify that existing LDAP/AD users can log in without username or email duplicate errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- authentication, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100