Wrong User Status in Sidebar

Description

Our Rocket chat sidebar show almost every user as offline, even though their status is different (e.g. online or away). In the admin panel under “Users”, their correct status is displayed, but still the sidebar shows them as offine.
Thanks you very much in advance for you help!

Server Setup Information

Any additional Information

Repeatedly found this error in the logs:

I20200921-15:14:32.677(0) Exception in defer callback: TypeError: Cannot read property ‘filter’ of undefined at RocketChatIntegrationHandler.getTriggersToExecute (app/integrations/server/lib/triggerHandler.js:505:16) at RocketChatIntegrationHandler.executeTriggers (app/integrations/server/lib/triggerHandler.js:576:34) at _wrapperFunction (app/integrations/server/triggers.js:6:38) at app/callbacks/lib/callbacks.js:147:65 at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12) at packages/meteor.js:550:25 at runWithEnvironment (packages/meteor.js:1286:24)

RC seems to not fetch the status of a user as long as the user is not in view. But it should fetch the status as soon as it becomes visible (usually takes 1-2 seconds).

Thanks for your response. Unfortunately, even when chatting with someone they still appear as offline, but not everywhere, let me be more precise:

  • offline in the user list
  • offline in the header on top of the chat
    BUT
  • online in the user info sidebar on the right that appears when I click the user name

Any ideas? I came across this, maybe that’s related?

The output of db.rocketchat_room.findOne({}) gives me this, so it seems the UID field is missing? What can I do to fix this if that’s the cause?

rs01:PRIMARY> db.rocketchat_room.findOne({})
{
	"_id" : "386p6cvp5BqKqtnoQ8vjfBGwTZfJ3noxHq",
	"_updatedAt" : ISODate("2020-05-25T06:51:49.658Z"),
	"msgs" : 50,
	"t" : "d",
	"ts" : ISODate("2020-04-01T12:08:45.228Z"),
	"usernames" : [
		"***",
		"***"
	],
	"usersCount" : 2,
	"lastMessage" : {
		"_id" : "ZHLRs25akLEGFhQCY",
		"rid" : "386p6cvp5BqKqtnoQ8vjfBGwTZfJ3noxHq",
		"msg" : "ok alles klar",
		"ts" : ISODate("2020-05-25T06:51:49.644Z"),
		"u" : {
			"_id" : "***",
			"username" : "***",
			"name" : "***"
		},
		"mentions" : [ ],
		"channels" : [ ],
		"_updatedAt" : ISODate("2020-05-25T06:51:49.648Z"),
		"sandstormSessionId" : null
	},
	"lm" : ISODate("2020-05-25T06:51:49.644Z")
}

Hey there.
We have the same problem on fresh install.
Version: 3.7.0

Hey,

did you upgrade from a very old version directly to 3.7.0?
Because, in our case this seemed to be the problem, as we were bypassing some required database migrations by just restoring the old database into the new rocket chat.

Meanwhile, we found a solution that worked for us. As mentioned in one of the links in my first post, our rooms where missing the uids field, so I wrote a script to fix this.

If your problem comes from the same root cause, the following script may help (use at your own risk!):

db = new Mongo().getDB("rocketchat");

result = db.rocketchat_room.find({"t" : "d"}).forEach(room => {
  username1 = room.usernames[0];
  username2 = room.usernames[1];
  if(!username1 || !username2) return;

  print(`fixing room of ` + username1 + ` and ` + username2);

  user1 = db.users.findOne({"username" : username1});
  uid1 = user1._id;
  //print(uid1);
  user2 = db.users.findOne({"username" : username2});
  uid2 = user2._id;
  //print(uid2);

  print(`Currently set uids: ` + room.uids);

  room.uids = [uid1, uid2];

  print(`Newly set uids: ` + room.uids);

  db.rocketchat_room.save(room);
});

Hey,
no, in our case it’s a new setup with a new database… But I’ll look into your script and try it in a test environment. Thanks!

@danielh, just checked if the rooms had “uids” field, and they do. So, it seems the root of the problem in our case lies somewhere else…

Damm even I am having a similar kind of issue, I have searched all over the internet and even have posted on number of threads on different forum, no solution seems to work. I am really frustrated, can anyone of you here help me resolve this issue, I am very much tired now.

Seems to be fixed in 3.0.8 hopefully!

yea it’s fixed now thanks!

I was facing the same issue, now its resolved, Many thanks for posting this article.
F90m firmware