Description
My issue consists of the following error message inside the rocket.chat pod logs:
{"level":50,"time":"2025-01-28T08:35:54.637Z","pid":1,"hostname":"rocketchat-server-0","name":"System","msg":"Exception while invoking method login","err":{"type":"Error","message":"remove + is not available on the server. Please use removeAsync() instead.","stack":"Error: remove + is not available on the server. Please use removeAsync() instead.\n at Object.ret.<computed> [as remove] (packages/mongo/remote_collection_driver.js:53:15)\n at Collection.remove (packages/mongo/collection.js:1016:29)\n at Collection.Mongo.Collection.<computed> [as remove] (packages/dispatch_run-as-user.js:346:17)\n at Object.OAuth._retrievePendingCredential (app/2fa/server/loginHandler.ts:88:29)\n at processTicksAndRejections (node:internal/process/task_queues:95:5)\n at MethodInvocation.<anonymous> (packages/accounts-oauth/oauth_server.js:18:18)\n at packages/accounts-base/accounts_server.js:593:9\n at tryLoginMethod (packages/accounts-base/accounts_server.js:1560:14)\n at AccountsServer._runLoginHandlers (packages/accounts-base/accounts_server.js:592:22)\n at AccountsServer.Accounts._runLoginHandlers (app/lib/server/lib/loginErrorMessageOverride.ts:9:17)\n at MethodInvocation.methods.login (packages/accounts-base/accounts_server.js:654:22)"}}
The error throws as soon as I try to login in in the Keycloak login interface on my Rocket.Chat instance. When checking on the session inside the Keycloak admin interface I can in fact see that the session exists and is active, so the login technically works.
Nevertheless, I get redirected back to https://rocketchat.local/home
where I see the login screen and inside the logs there is the error from above.
What have I tried / found out
I did research this problem for the last day and I have found this link to the GitHub issues discussion for Rocket.Chat https://github.com/RocketChat/Rocket.Chat/issues/34184
.
For the guy in the issue thread the problem arose because of a typo in his userinfo endpoint configuration. I have already checked those configs multiple times and I do not have any of them wrongly configured . Proof of that is that the Keycloak login session is active like I described above.
I read the official documentation carefully and followed it during the setup process at https://docs.rocket.chat/docs/openid-connect-keycloak
I also have found and used another guide here (I do not use Gazelle but I have oriented myself in this guide about the Keycloak configuration inside Rocket.Chat in general): https://validation.sequoiaproject.org/gazelle-documentation/Gazelle-Keycloak/rocketchat.html#top
Then I have informed myself about the remove()
and removeAsync()
functions and I found that they are already deprecated and instead one should use deleteOne()
and deleteMany()
.
As a next step I tried to downgrade my MongoDB so that those old functions can be used again so I saw that my Rocket.Chat instance would be compatible with MongoDB 5.x. I have pulled such image and found out that the remove()
and removeAsync()
are already deprecated for that version too. Strangely, those functions do exist - so they can be used but MongoDB will give you a warning about them being deprecated, but for whatever reason the error tells me that those functions do not exist at all …
When it comes to compatibility I have seen inside the release notes of my Rocket.Chat version that I am compatible with the versions of MongoDB and Node that I am using here https://github.com/RocketChat/Rocket.Chat/releases/tag/7.2.1
Server Setup Information
- Version of Rocket.Chat Server: 7.2.1
- Operating System: Linux (Docker Image)
- Apps Engine Version: 1.48.1
- Deployment Method: Kubernetes / Docker
- Number of Running Instances: 2
- DB Replicaset Oplog: Yes (1 member inside the replication set)
- NodeJS Version: v22.11.0
- MongoDB Version: 6.0.13 / wiredTiger (oplog Enabled)
- Proxy: nginx
- Firewalls involved: no