New LDAP users can't login/get crated: usersInRole.toArray(...).forEach is not a function


We use RocketChat (community) in connection with a LDAP directory.
In the past new users showed up in RocketChat after the first login but required
some manual steps (activate, assign roles).

Presently - at least since version 6.2.1 this is not working anymore. Instead we see errors
in the RocketChat logs like this one coming from the “LDAP Data Converter”:

TypeError: usersInRole.toArray(…).forEach is not a function at app/authentication/server/startup/index.js:198:31

See below for the complete log record. A quick look into GitHub suggest that this might be connected to an attempt to inform the admin users about a new user. So I tried to create the user manually on the GUI. There I have seen a similar message but nothing in the server-side logs. Also I had a look at the representation of the admin users in mongodb but failed to spot anything fancy.

Any ideas what may be wrong?

Server Setup Information

  • Version of Rocket.Chat Server: 6.2.2
  • Operating System: Debian Linux 11 (stable, newest patches)
  • Deployment Method: tar
  • Number of Running Instances: 1
  • DB Replicaset Oplog: ?
  • NodeJS Version: 14.21.3
  • MongoDB Version: 5.0.14
  • Proxy: Apache behind firewall behind Reverse Proxy
  • Firewalls involved: yes

Any additional Information

Full log entry:

May 24 15:08:29 rocketchat rocketchat[157647]: {"level":50,"time":"2023-05-24T13:08:29.354Z","pid":157647,"hostname":"rocketchat","name":"LDAP Data Converter","err":{"type":"TypeError","message":"usersInRole.toArray(...).forEach is not a function","stack":"TypeError: usersInRole.toArray(...).forEach is not a function\n at app/authentication/server/startup/index.js:198:31\n at /data/rocketchat/6.2.2/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40\n => awaited here:\n at Function.Promise.await (/data/rocketchat/6.2.2/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)\n at AccountsServer._onCreateUserHook (app/authentication/server/startup/index.js:230:17)\n at AccountsServer.insertUserDoc (packages/accounts-base/accounts_server.js:1179:23)\n at app/authentication/server/startup/index.js:265:28\n at /data/rocketchat/6.2.2/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40\n => awaited here:\n at Function.Promise.await (/data/rocketchat/6.2.2/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:321:17)\n at AccountsServer._createUserCheckingDuplicates (packages/accounts-base/accounts_server.js:1473:25)\n at packages/accounts-password/password_server.js:949:19\n at /data/rocketchat/6.2.2/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40\n => awaited here:\n at Function.Promise.await (/data/rocketchat/6.2.2/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)\n at app/importer/server/classes/ImportDataConverter.ts:284:40\n at /data/rocketchat/6.2.2/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40\n => awaited here:\n at Function.Promise.await (/data/rocketchat/6.2.2/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)\n at app/importer/server/classes/ImportDataConverter.ts:362:18\n at /data/rocketchat/6.2.2/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40"},"msg":"usersInRole.toArray(...).forEach is not a function"}

We’re currently experiencing the same issue on our instance. I’m looking into it and I’ll update this thread if I figure it out. Any luck on your end?

Update to this: it is not an LDAP issue, it is an issue with the “Manually confirm new users” setting and would prevent making users in the GUI as well. There is a bug for it here: Manually Approve New Users - does not work · Issue #29411 · RocketChat/Rocket.Chat · GitHub

The workaround for now is to turn that off until an update fixes it.

Thanks for the link to to the issue #29411. That seems to be a good match.

About your first question:
So far I was - kind of - lucky: The new employee I wanted to activate
had not sigh the contract yet and jump off the last moment.
Already considered to fake the entry in MongoDb manually.
So I have no news to report about the issue.