RocketChat / RocketChat/Rocket.Chat

PlanExecutor error, cant open users in admin panel/Users get deactivated when they try to login

Open
#31,203 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description:

Hello,
Since last week certain users cannot login to RocketChat on Browser, even if they put in the correct data. Their account gets deactivated, "active": false is set if they try to log in. Followed by the "ask a administrator to activate the account manually".
When trying to open the User List in the admin panel , a "PlanExecutor error" gets thrown (full log at the bottom).
It is still possible to query the users list for certain strings without an error /v1/users.list?query={ "name": { "$regex": "P" } }.
Other queries for specific strings still throw the PlanExecutor error (for example /v1/users.list?query={ "name": { "$regex": "A" } }).

What could cause these problems?

Expected behavior:
  1. Go to admin panel
  2. Click on 'Users'
  3. Users should be listed
Actual behavior:
  1. Go to admin panel
  2. Click on 'Users'
  3. PlanExecutor error
Server Setup Information:
Version of Rocket.Chat Server: 6.5
Operating System: ubuntu 22.04
Deployment Method: snap
Number of Running Instances: 1
DB Replicaset Oplog:
NodeJS Version: 14.21.2
MongoDB Version: 5.0.15
Proxy: apache
Firewalls involved:
Client Setup Information
  • Desktop App or Browser Version: Browser
  • Operating System: Windows 10
Relevant logs:

"err":{"type":"MongoServerError","message":"PlanExecutor error during aggregation :: caused by :: can't convert from BSON type array to String","stack":"MongoServerError: PlanExecutor error during aggregation :: caused by :: can't convert from BSON type array to String<br> at Connection.onMessage (/snap/rocketchat-server/1597/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/connection.js:231:30)<br> at MessageStream.<anonymous> (/snap/rocketchat-server/1597/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/connection.js:61:60)<br> at MessageStream.emit (events.js:400:28)<br> at MessageStream.emit (domain.js:475:12)<br> at processIncomingData (/snap/rocketchat-server/1597/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/message_stream.js:125:16)<br> at MessageStream._write (/snap/rocketchat-server/1597/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/message_stream.js:33:9)<br> at writeOrBuffer (internal/streams/writable.js:358:12)<br> at MessageStream.Writable.write (internal/streams/writable.js:303:10)<br> at Socket.ondata (internal/streams/readable.js:731:22)<br> at Socket.emit (events.js:400:28)<br> at Socket.emit (domain.js:475:12)<br> at addChunk (internal/streams/readable.js:293:12)<br> at readableAddChunk (internal/streams/readable.js:267:9)<br> at Socket.Readable.push (internal/streams/readable.js:206:10)<br> at TCP.onStreamRead (internal/stream_base_commons.js:188:23)<br> at TCP.callbackTrampoline (internal/async_hooks.js:130:17)<br> => awaited here:<br> at Function.Promise.await (/snap/rocketchat-server/1597/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)<br> at app/api/server/v1/users.ts:511:16<br> at /snap/rocketchat-server/1597/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40<br> => awaited here:<br> at Function.Promise.await (/snap/rocketchat-server/1597/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)<br> at packages/meteor.js:367:22<br> at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1389:31)<br> at app/api/server/api.ts:635:39<br> at /snap/rocketchat-server/1597/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40","ok":0,"code":16007,"codeName":"Location16007","$clusterTime":{"clusterTime":{"$timestamp":"7311312120627331073"},"operationTime":{"$timestamp":"7311312120627331073"}},"status":400,"responseTime":16,"msg":"PlanExecutor error during aggregation :: caused by :: can't convert from BSON type array to String"}

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 at app/api/server/v1/users.ts around line 511 and reproduce the users.list requests described in the issue, including the regex queries that trigger the MongoDB PlanExecutor error. Compare the failing aggregation behavior with the affected login flow; done means the admin Users list loads and affected users are not deactivated during login.

Written by the indexing model from the issue text.

Assessment

Tech stack
mongodb, typescript
Domain
api, authentication, backend, databases
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.