Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

LDAP sync (Email already exists)

Open sureshdba2003 opened this issue 10 years ago • 11 comments

Your Rocket.Chat version: 0.40 Unable to merge with existing user using LDAP sync.

I20160928-12:35:51.781(5.5) rocketchat:ldap sync.js:184 LDAPSync ➔ error Error creating user { [Error: Email already exists. [403]] error: 403, reason: 'Email already exists.', details: undefined, message: 'Email already exists. [403]', errorType: 'Meteor.Error' } I20160928-12:35:51.783(5.5) rocketchat:ldap sync.js:249 LDAPSync ➔ error { [Error: Email already exists. [403]] error: 403, reason: 'Email already exists.', details: undefined, message: 'Email already exists. [403]', errorType: 'Meteor.Error' }

sureshdba2003 avatar Sep 28 '16 07:09 sureshdba2003

Also, In Info menu shows that 186 users, but in users menu shown that 40 users.

sureshdba2003 avatar Sep 28 '16 08:09 sureshdba2003

Probably this error is caused by conflicting accounts between Rocket and Ldap. Same email in rocket and Ldap, different usernames. The easiest way to fix is to find out which account is causing the exception, then go into RocketChat, Administration, Users, find the user, edit the user and change the username to the exact value as in Ldap.

alexandrezia avatar Oct 02 '16 21:10 alexandrezia

I have a similar issue. I see the error, but no idea where to find which user to fix.

khobbits avatar Oct 05 '16 00:10 khobbits

enable Debug Log

alexandrezia avatar Oct 05 '16 00:10 alexandrezia

The same issue here - we are trying to sync users that were created by Google oauth with our LDAP - but even after manually changing all usernames to match LDAP it doesn't work and it shows Email already exists messages.

danpospisil avatar Dec 14 '16 15:12 danpospisil

@alexandrezia This was the exact problem that I had. On my initial setup I had used my email account as my username instead of my LDAP. Correcting the username in RocketChat to match LDAP fixed the problem.

stu1972 avatar Jan 31 '17 22:01 stu1972

Hello! I have same error:

Please added decription about username.


{"name":"ldapjs","component":"client","hostname":"52ad76182ca4","pid":1,"clazz":"Client","level":10,"msg":"Parsing done: {\"messageID\":4,\"protocolOp\":\"SearchEntry\",\"objectName\":\"cn=MYNAME.MYSURNAME,ou=Users,dc=MYCOMPANY,dc=io\",\"attributes\":[{\"type\":\"objectClass\",\"vals\":[\"pwmUser\",\"inetOrgPerson\"]},{\"type\":\"manager\",\"vals\":[\"cn=MYNAME.MYNAME,ou=Users,dc=MYCOMPANY,dc=io\"]},{\"type\":\"cn\",\"vals\":[\"MYNAME.MYSURNAME\"]},{\"type\":\"loginExpirationTime\",\"vals\":[\"20180829210000Z\"]},{\"type\":\"pwmGUID\",\"vals\":[\"50cdc127-820c-4daf-8260-c6bb606b1565\"]},{\"type\":\"mail\",\"vals\":[\"[email protected]\"]},{\"type\":\"displayName\",\"vals\":[\"MYNAME1 MYSURNAME1 \"]},{\"type\":\"sn\",\"vals\":[\"MYSURNAME\"]},{\"type\":\"givenName\",\"vals\":[\"Nataliya\"]}],\"controls\":[]}","time":"2018-08-16T07:04:05.370Z","v":0}
{"name":"ldapjs","component":"client","hostname":"52ad76182ca4","pid":1,"clazz":"Client","ldap_id":"2__ldaps://ldap..MYCOMPANY.io:636","level":10,"msg":"response received","time":"2018-08-16T07:04:05.370Z","v":0}
{"name":"ldapjs","component":"client","hostname":"52ad76182ca4","pid":1,"clazz":"Client","level":10,"msg":"data event: <Buffer 30 31 02 01 04 65 07 0a 01 00 04 00 04 00 a0 23 30 21 04 16 31 2e 32 2e 38 34 30 2e 31 31 33 35 35 36 2e 31 2e 34 2e 33 31 39 04 07 30 05 02 01 00 04 ... >","time":"2018-08-16T07:04:05.370Z","v":0}
{"name":"ldapjs","component":"client","hostname":"52ad76182ca4","pid":1,"clazz":"Client","level":10,"msg":"parse: data=<Buffer 0a 01 00 04 00 04 00 a0 23 30 21 04 16 31 2e 32 2e 38 34 30 2e 31 31 33 35 35 36 2e 31 2e 34 2e 33 31 39 04 07 30 05 02 01 00 04 00>","time":"2018-08-16T07:04:05.370Z","v":0}
{"name":"ldapjs","component":"client","hostname":"52ad76182ca4","pid":1,"clazz":"Client","level":10,"msg":"Parsing done: {\"messageID\":4,\"protocolOp\":\"LDAPResult\",\"status\":0,\"matchedDN\":\"\",\"errorMessage\":\"\",\"referrals\":[],\"controls\":[{\"_value\":{\"size\":0,\"cookie\":{\"type\":\"Buffer\",\"data\":[]}},\"type\":\"1.2.840.113556.1.4.319\",\"criticality\":false}]}","time":"2018-08-16T07:04:05.370Z","v":0}
{"name":"ldapjs","component":"client","hostname":"52ad76182ca4","pid":1,"clazz":"Client","ldap_id":"2__ldaps://ldap..MYCOMPANY.io:636","level":10,"msg":"response received","time":"2018-08-16T07:04:05.371Z","v":0}
rocketchat_logger rocketchat_logger.js:278 LDAPSync ➔ error Error creating user { Error: Username already exists. [403]
    at AccountsServer.Ap.insertUserDoc (/app/bundle/programs/server/packages/accounts-base.js:1766:52)
    at AccountsServer.<anonymous> (/app/bundle/programs/server/app/app.js:569:29)
    at executeBound (/app/bundle/programs/server/npm/node_modules/underscore/underscore.js:762:67)
    at AccountsServer.bound [as insertUserDoc] (/app/bundle/programs/server/npm/node_modules/underscore/underscore.js:793:14)
    at createUser (/app/bundle/programs/server/packages/accounts-password.js:1242:25)
    at AccountsServer.Accounts.createUser (/app/bundle/programs/server/packages/accounts-password.js:1302:10)
    at addLdapUser (/app/bundle/programs/server/packages/rocketchat_ldap.js:1291:31)
    at ldapUsers.forEach.ldapUser (/app/bundle/programs/server/packages/rocketchat_ldap.js:1353:9)
    at Array.forEach (<anonymous>:null:null)
    at ldap.searchUsersSync.Meteor.bindEnvironment (/app/bundle/programs/server/packages/rocketchat_ldap.js:1323:15)
    at runWithEnvironment (packages/meteor.js:1238:24)

  isClientSafe: true,
  error: 403,
  reason: 'Username already exists.',
  details: undefined,
  message: 'Username already exists. [403]',
  errorType: 'Meteor.Error' }

What is the user name already exists?

patsevanton avatar Aug 16 '18 07:08 patsevanton

I get the same error. Would be great, if a matching name and e-mail-adress would optionally cause the password to be synched with ldap and the users merged.

I20190512-12:04:40.441(0) server.js:199 LDAPSync ➔ error Error creating user { Error: Email already exists. [403] at handleError (packages/accounts-password/password_server.js:104:17) at checkForCaseInsensitiveDuplicates (packages/accounts-password/password_server.js:245:7) at createUser (packages/accounts-password/password_server.js:1076:3) at AccountsServer.Accounts.createUser (packages/accounts-password/password_server.js:1147:10) at addLdapUser (app/ldap/server/sync.js:260:29) at ldapUsers.forEach.ldapUser (app/ldap/server/sync.js:323:5) at Array.forEach (<anonymous>) at ldap.searchUsersSync.Meteor.bindEnvironment (app/ldap/server/sync.js:290:13) at runWithEnvironment (packages/meteor.js:1356:24) isClientSafe: true, error: 403, reason: 'Email already exists.', details: undefined, message: 'Email already exists. [403]', errorType: 'Meteor.Error' }

saschafoerster avatar May 12 '19 12:05 saschafoerster

Same error

lucassmacedo avatar Sep 02 '19 15:09 lucassmacedo

A suggestion for the RocketChat developers here. Can the username and email address that are causing the problems be put in the error message? I have an LDAP directory of around 700 users. Chasing down the account that is causing issues is a real problem.

jschewebbn avatar Sep 17 '19 10:09 jschewebbn

This helped me solve the problem: https://github.com/RocketChat/Rocket.Chat/issues/11502#issuecomment-406201275 The message is still there, but login works after changing the options.

saschafoerster avatar Sep 28 '19 21:09 saschafoerster