Rocket.Chat
Rocket.Chat copied to clipboard
"Oops! Something went wrong" while opening some channels via web/desktop since 5.0.0
Description:
Since 5.0.0 we can't open some chats. Got "Oops! Something went wrong." on web/desktop only. Android works fine. No errors in logs, even in debug mode. In browser console: "TypeError: j.replies is undefined"
All this channels was imported from slack earlier and worked just fine. But since 5.0.0 if chat has a thread from slack - this chat can't be opened. When viewing from android app I've noticed that old threads from slack displayed as e.g. "Messages: 24, Users: 0". After I deleted all this threads - errors gone.

Steps to reproduce:
- Install some old version like 4.6.*
- Import data from slack
- Upgrade every single release up to 5.0.0
Server Setup Information:
- Version of Rocket.Chat Server: 5.0.0
- Operating System: Ubuntu 20.04 LTS
- Deployment Method: docker
If it needs some diagnostics, I can perform queries in mongo.
I can confirm this in 5.0.0-rc12 with manual implementation... In our case no channel was imported, it happens with all rooms created in the service
Confirm that
duplicate of https://github.com/RocketChat/Rocket.Chat/issues/26352
I already saw the #26352 but I thought it is different bug, since my related to room/chat, not user profile.
https://github.com/RocketChat/Rocket.Chat/issues/26352#issuecomment-1198361464
I still think that this is a different problem than in #26352 Perhaps they are related.
We noticed that the error pops up at the moment when messages imported from Slack appear. For example, we imported messages in February - and the channels work fine, but when you scroll through the history and scroll to the last imported message, an error pops up.
Error:
Uncaught Error: TypeError: Cannot read properties of undefined (reading 'indexOf')
at O (/client/views/room/MessageList/components/MessageContent.tsx:1:2814)
at Dc (07209f7aff72860ca8f6c4de51803a1e16f37033.js?meteor_js_resource=true:1124:59696)
at gi (07209f7aff72860ca8f6c4de51803a1e16f37033.js?meteor_js_resource=true:1124:69176)
at di (07209f7aff72860ca8f6c4de51803a1e16f37033.js?meteor_js_resource=true:1124:68510)
at li (07209f7aff72860ca8f6c4de51803a1e16f37033.js?meteor_js_resource=true:1124:68168)
at Rs (07209f7aff72860ca8f6c4de51803a1e16f37033.js?meteor_js_resource=true:1124:114835)
at nu (07209f7aff72860ca8f6c4de51803a1e16f37033.js?meteor_js_resource=true:1124:98840)
at ru (07209f7aff72860ca8f6c4de51803a1e16f37033.js?meteor_js_resource=true:1124:98768)
at eu (07209f7aff72860ca8f6c4de51803a1e16f37033.js?meteor_js_resource=true:1124:98631)
at Gs (07209f7aff72860ca8f6c4de51803a1e16f37033.js?meteor_js_resource=true:1124:95485) {componentStack: '\n at O (/client/views/room/MessageList/componen…esource=true:1218:63317)\n at Suspense\n at f'}
I still think that this is a different problem than in #26352 Perhaps they are related.
We noticed that the error pops up at the moment when messages imported from Slack appear. For example, we imported messages in February - and the channels work fine, but when you scroll through the history and scroll to the last imported message, an error pops up.
Same here. We have this error in all channels when scrolling up to old messages imported from Slack.
I still think that this is a different problem than in #26352 Perhaps they are related. We noticed that the error pops up at the moment when messages imported from Slack appear. For example, we imported messages in February - and the channels work fine, but when you scroll through the history and scroll to the last imported message, an error pops up.
Same here. We have this error in all channels when scrolling up to old messages imported from Slack.
Same here.
Seems I've found a root cause.
In 'normal' threads there is a field replies along with tcount and tlm
"replies" : [ "YXFgesNuvbBpD5hnt", "QYSfQEECvgruQBLpS", "KXcDtcEqGzoGXaoo9", "jhZvN4nZeZkdEifKZ", "dHFpxLQRBdGGcwWmW", "jMNxBjrxuRGvosEzH", "sEDKfb2LqCzmhYjug" ], "tcount" : 14, "tlm" : ISODate("2022-06-10T14:39:35.485Z")
But in threads imported from slack there is not replies, but frontend expects it should be when tcount and tlm exists.
Some routine to fix this threads maybe needed.
Just tried this hack, and it works decent. On all this threads displayed only one participants, but at least all works now and channels/threads can be opened.
db.rocketchat_message.updateMany({ _id:/slack-/, tcount: { $exists :1}, replies : { $exists: 0}},{ $set: { replies: [ "rocket.cat" ] } })
Didn't fix error for me. Got matchedCount and modifiedCount 0.0.
Try to do use rocketchat in mongo before query.
I thought i've selected db before query. modifiedCount: 2703 And this did the trick! All merged messages and threads are now in place and no error hits the screen. Big thx!
Im having this issue with one channel. How do I implement this DB hack? Im new to Rocket.chat .
@dotty37 if your rocketchat ran from docker-compose then you can run docker-compose exec mongo mongo rocketchat and apply command into opened console.
Hi
I deployed using the AWS AMI, 4.0.7, imported the Slack ZIP file and then upgraded to 5.0.3. I didn't import on 5.0.3 directly because there is an issue with that already reported on Github. If you provide me with some insight on how to run this, then I will give it a try.
Thanks !
On Thu, Aug 18, 2022 at 2:01 PM Aleksey Zagorodnikov < @.***> wrote:
@dotty37 https://github.com/dotty37 if your rocketchat ran from docker-compose then you can run docker-compose exec mongo mongo rocketchat and apply command into opened console.
— Reply to this email directly, view it on GitHub https://github.com/RocketChat/Rocket.Chat/issues/26365#issuecomment-1219779751, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALLNAUEKBKJ5QGEZR3AD7OTVZZ3AXANCNFSM54WHPD4A . You are receiving this because you were mentioned.Message ID: @.***>
Unfortunately, I'm not familiar with AWS at all. You should find a way to go to mongo console and run queries.
Just tried this hack, and it works decent. On all this threads displayed only one participants, but at least all works now and channels/threads can be opened.
db.rocketchat_message.updateMany({ _id:/slack-/, tcount: { $exists :1}, replies : { $exists: 0}},{ $set: { replies: [ "rocket.cat" ] } })
This hack worked for me and I couldn't find any rooms that are still not working
same error from ver 5.0.2
If you installed or updated from Snap Package, you can fix it by doing the following
$ rocketchat-server.mongo
----
rs0:PRIMARY> use parties;
rs0:PRIMARY> db.rocketchat_message.updateMany({ _id:/slack-/, tcount: { $exists :1}, replies : { $exists: 0}},{ $set: { replies: [ "rocket.cat" ] } });
@iglooom Thanks for your great tips!
Just tried this hack, and it works decent. On all this threads displayed only one participants, but at least all works now and channels/threads can be opened.
db.rocketchat_message.updateMany({ _id:/slack-/, tcount: { $exists :1}, replies : { $exists: 0}},{ $set: { replies: [ "rocket.cat" ] } })
Is there a plan to fix this bug properly? Or at least compute a better manual query fix? ie so threads don't just show "only one participant" ?
I've fixed it "more properly" by computing the replies properly.
I did it via python... so install pip,
ie on debian, apt install python-pip
and then install pymongo python -m pip install pymongo or probably just pip install pymongo
And then in python
from pymongo import MongoClient
client = MongoClient("localhost")
db = client.rocketchat
table = db.rocketchat_message
for m in table.find({'_id':{'$regex':'^slack-'}, 'tcount': {'$exists':1}, 'replies': {'$exists':0}}):
r = table.distinct('u._id', {'tmid':m['_id']})
table.update_one({'_id':m['_id']}, {'$set':{'replies':r}})
Note that I do NOT think this fixes all the missing things. For example, there is no "value" field in the slack document items, ie there is no:
- 'md' field (markdown, i assume),
- 'channels' field,
- 'u.name' field (name of user)
- '_updatedAt'
- 'mentions'
Without these, will future versions of RocketChat crash?
Unfortunately, I'm not familiar with AWS at all. You should find a way to go to mongo console and run queries.
I finally had the chance to work on it today. I just had to do mongo --port 27017 and bang, inside the db. Typed the query hack and everything works now. Tested across reboots too. :-)
@pierre-lehnen-rc You've fixed a handful of other slack import issues and this one looks like there's a fair bit of user research here to point the fix in the right direction. Any chance this one might fit into the team's workload?
Fixed by #26652
Thanks, you rock.