Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

"Oops! Something went wrong" while opening some channels via web/desktop since 5.0.0

Open iglooom opened this issue 3 years ago • 8 comments

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.

photo_2022-07-26_18-32-23

Steps to reproduce:

  1. Install some old version like 4.6.*
  2. Import data from slack
  3. 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.

iglooom avatar Jul 26 '22 14:07 iglooom

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

aleadco avatar Jul 26 '22 18:07 aleadco

Confirm that

lovekyleman avatar Jul 26 '22 23:07 lovekyleman

duplicate of https://github.com/RocketChat/Rocket.Chat/issues/26352

ankar84 avatar Jul 27 '22 02:07 ankar84

I already saw the #26352 but I thought it is different bug, since my related to room/chat, not user profile.

iglooom avatar Jul 27 '22 05:07 iglooom

https://github.com/RocketChat/Rocket.Chat/issues/26352#issuecomment-1198361464

treebes avatar Jul 28 '22 16:07 treebes

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'}

charisteed28 avatar Aug 02 '22 14:08 charisteed28

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.

terR0Q avatar Aug 04 '22 17:08 terR0Q

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.

Weterok avatar Aug 05 '22 11:08 Weterok

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.

iglooom avatar Aug 13 '22 09:08 iglooom

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" ] } })

iglooom avatar Aug 13 '22 10:08 iglooom

Didn't fix error for me. Got matchedCount and modifiedCount 0.0.

terR0Q avatar Aug 14 '22 20:08 terR0Q

Try to do use rocketchat in mongo before query.

iglooom avatar Aug 15 '22 09:08 iglooom

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!

terR0Q avatar Aug 16 '22 15:08 terR0Q

Im having this issue with one channel. How do I implement this DB hack? Im new to Rocket.chat .

dotty37 avatar Aug 18 '22 01:08 dotty37

@dotty37 if your rocketchat ran from docker-compose then you can run docker-compose exec mongo mongo rocketchat and apply command into opened console.

iglooom avatar Aug 18 '22 18:08 iglooom

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: @.***>

dotty37 avatar Aug 18 '22 20:08 dotty37

Unfortunately, I'm not familiar with AWS at all. You should find a way to go to mongo console and run queries.

iglooom avatar Aug 19 '22 08:08 iglooom

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

LeoColman avatar Aug 26 '22 16:08 LeoColman

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" ] } })

RyousukeUchino avatar Aug 30 '22 17:08 RyousukeUchino

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" ?

paulharris avatar Sep 13 '22 04:09 paulharris

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?

paulharris avatar Sep 13 '22 06:09 paulharris

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. :-)

dotty37 avatar Sep 13 '22 12:09 dotty37

@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?

shaymdev avatar Sep 14 '22 15:09 shaymdev

Fixed by #26652

pierre-lehnen-rc avatar Sep 14 '22 16:09 pierre-lehnen-rc

Thanks, you rock.

shaymdev avatar Sep 14 '22 16:09 shaymdev