RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.4k stars 10.51k forks source link

"Uncaught Error" in some group chats with new message template in Desktop App #26639

Open krenuser opened 2 years ago

krenuser commented 2 years ago

Description:

"Oops! Something went wrong. Please reload the page or contact an administrator." error while viewing some chats. Problem occurs only in Desktop App and only for some group chats (I haven't found any differences in chats working fine and failing). Browser version works fine for all chats failing in Desktop app.

Enabling "Use legacy message template" in My Account > Preferences fixes the problem.

Steps to reproduce:

  1. Open some chat created in previous RC version in Desktop App.

Expected behavior:

Chat is opened, all messages are visible, history is being loaded while scrolling.

Actual behavior:

[+] chat opened [+] message history shown [!] in 2-3 seconds after chat is opened and message history shown image

Server Setup Information:

Client Setup Information

Additional context

none

Relevant logs:

Browser logs: image

[Browser logs pasted as text here become unreadable]

"componentStack" property for Uncaught Error: TypeError: Cannot read properties of undefined (reading 'indexOf') (num.2 on the screenshot)

"
    at O (/client/views/room/MessageList/components/MessageContent.tsx:1:1719)
    at div
    at va
    at div
    at https://chat.domain.ltd/de2a0a98a668e5a193ce98f6f7dfcb36e7148079.js?meteor_js_resource=true:13:504489
    at v (/client/views/room/MessageList/components/Message.tsx:1:1156)
    at a (/client/views/room/MessageList/providers/MessageHighlightProvider.tsx:1:311)
    at l (/client/views/room/providers/SelectedMessagesProvider.tsx:1:1022)
    at e (/client/views/room/providers/MessageProvider.tsx:1:999)
    at B (/client/views/room/providers/ToolboxProvider.tsx:1:997)
    at e (/client/views/room/MessageList/providers/MessageListProvider.tsx:1:1231)
    at t (https://chat.domain.ltd/de2a0a98a668e5a193ce98f6f7dfcb36e7148079.js?meteor_js_resource=true:1044:29683)
    at d (/client/views/room/MessageList/MessageListErrorBoundary.tsx:1:400)
    at q (/client/views/room/MessageList/MessageList.tsx:1:1413)
    at Suspense
    at https://chat.domain.ltd/de2a0a98a668e5a193ce98f6f7dfcb36e7148079.js?meteor_js_resource=true:1558:1129517
    at p (/client/views/root/AppLayout.tsx:1:424)
    at m (https://chat.domain.ltd/de2a0a98a668e5a193ce98f6f7dfcb36e7148079.js?meteor_js_resource=true:1558:1054424)
    at d (/client/components/message/Attachments/providers/AttachmentProvider.tsx:1:362)
    at L (/client/providers/OmnichannelProvider.tsx:1:1010)
    at Q (/client/providers/CallProvider/CallProvider.tsx:1:1792)
    at g (/client/providers/VideoConfProvider.tsx:1:618)
    at P (/client/providers/AuthorizationProvider.tsx:1:932)
    at d (/client/providers/ModalProvider.tsx:1:349)
    at d (/client/providers/DeviceProvider/DeviceProvider.tsx:1:388)
    at g (/client/providers/UserProvider.tsx:1:813)
    at c (/client/providers/CustomSoundProvider.tsx:1:245)
    at v (/client/providers/AvatarUrlProvider.tsx:1:489)
    at r (/client/providers/LayoutProvider.tsx:1:350)
    at y (/client/providers/SettingsProvider.tsx:1:706)
    at h (/client/providers/ToastMessagesProvider.tsx:1:453)
    at p (/node_modules/@rocket.chat/fuselage-toastbar/dist/esm/ToastBarProvider.js:1:709)
    at g (/client/providers/ToastMessagesProvider.tsx:1:748)
    at v (/client/providers/TooltipProvider.tsx:1:435)
    at l (/client/providers/SessionProvider.tsx:1:353)
    at d (/client/providers/TranslationProvider.js:1:1203)
    at k (/client/providers/RouterProvider.tsx:1:967)
    at h (/client/providers/ServerProvider.tsx:1:1002)
    at i (/client/providers/ConnectionStatusProvider.tsx:1:399)
    at D (/client/providers/MeteorProvider.tsx:1:1150)
    at e (https://chat.domain.ltd/de2a0a98a668e5a193ce98f6f7dfcb36e7148079.js?meteor_js_resource=true:1218:63317)
    at Suspense
    at f"

SERVER LOGS No relevant logs

jeanfbrito commented 2 years ago

@debdutdeb this doesn't seem to be an Electron issue. Did you take a look at the logs?

debdutdeb commented 2 years ago

The issue mentioned this only happening on the desktop app 🙈 made sense to transfer here for further investigation.

krenuser commented 2 years ago

This is /app/bundle/programs/web.browser/dynamic/client/views/room/MessageList/components/MessageContent.tsx file (pretty-printed) in RockerChat Docker container: image

It has been mentioned in DevConsole error. Adding two highlighted conditions to the file fixes my problem (checked by editing source directly in container and restarting server, cleaning cache and storage data in client). Unfortunately, I'm new to Meteor, React and TypeScript, and can't find corresponding source in RC/RC.Electron repo.

jeanfbrito commented 2 years ago

This is /app/bundle/programs/web.browser/dynamic/client/views/room/MessageList/components/MessageContent.tsx file (pretty-printed) in RockerChat Docker container: image

It has been mentioned in DevConsole error. Adding two highlighted conditions to the file fixes my problem (checked by editing source directly in container and restarting server, cleaning cache and storage data in client). Unfortunately, I'm new to Meteor, React and TypeScript, and can't find corresponding source in RC/RC.Electron repo.

I think that this is the line: https://github.com/RocketChat/Rocket.Chat/blob/develop/apps/meteor/client/views/room/MessageList/components/MessageContent.tsx#L85

Please @debdutdeb could you validate this?

krenuser commented 2 years ago

Seems that issue should be returned to Rocket.Chat repo. Found issues in https://github.com/RocketChat/Rocket.Chat repo: apps/meteor/client/views/room/MessageList/components/MessageContent.tsx:85 and apps/meteor/client/views/room/MessageList/components/MessageContent.tsx:92

Checks for message.replies should be added.

debdutdeb commented 2 years ago

Thanks for checking folks. You're right. Transfering to main repo. BTW - PRs are welcome ;)

krenuser commented 2 years ago

BTW - PRs are welcome ;)

@debdutdeb , preparing one now)

krenuser commented 2 years ago

Still here in 5.1.2. Hasn't fix above been included to 5.1.2 build?

akong77 commented 1 year ago

Hello, My server is 6.3.1 and client is 3.9.6. My user has show the same error message.

Oops! Something went wrong. Please reload the page or contact an administrator.