mattermost / mattermost-mobile

Next generation iOS and Android apps for Mattermost in React Native
https://about.mattermost.com/
Apache License 2.0
2.25k stars 1.36k forks source link

App Crash: "TypeError: Cannot read property 'props' of undefined" #7864

Closed pyhsieh-cyberbiz closed 8 months ago

pyhsieh-cyberbiz commented 8 months ago

Summary

App crashes and requires relaunch when entering specific channel.

Environment Information

Steps to reproduce

Cannot reproduce, but it only occurs when entering one of the channels in our workspace.

Expected behavior

Successfully enter the channel and showing conversation in the channel.

Observed behavior (that appears unintentional)

App crashes with popup message showing error message, asking user to relaunch App and to report problem.

Log and error message (hostname and channel info are replaced with placeholders):

2024/02/25 14:38:31:136 DEBUG Setting the badge count based on database values to 0
2024/02/25 14:40:25:173 DEBUG Setting the badge count based on database values to 0
2024/02/25 14:40:41:195 INFO websocket closed wss://HOSTNAME/api/v4/websocket?connection_id=6fmz5f4t73d3jgf4ie1x644skc&sequence_number=16
2024/02/25 14:41:34:986 INFO websocket re-established connection to wss://HOSTNAME/api/v4/websocket?connection_id=6fmz5f4t73d3jgf4ie1x644skc&sequence_number=20
2024/02/25 14:41:35:806 DEBUG Setting the badge count based on database values to 0
2024/02/25 14:41:50:960 INFO websocket closed wss://HOSTNAME/api/v4/websocket?connection_id=6fmz5f4t73d3jgf4ie1x644skc&sequence_number=20
2024/02/25 14:45:54:951 INFO websocket re-established connection to wss://HOSTNAME/api/v4/websocket?connection_id=6fmz5f4t73d3jgf4ie1x644skc&sequence_number=22
2024/02/25 14:46:17:100 DEBUG Setting the badge count based on database values to 0
2024/02/25 14:51:41:103 INFO Launch app in Home screen
2024/02/25 14:51:41:107 INFO websocket connecting to wss://HOSTNAME/api/v4/websocket?connection_id=&sequence_number=0
2024/02/25 14:51:41:122 INFO Running "Home
2024/02/25 14:51:41:333 INFO websocket connected to wss://HOSTNAME/api/v4/websocket?connection_id=&sequence_number=0
2024/02/25 14:51:41:333 DEBUG Setting the badge count based on database values to 0
2024/02/25 14:51:41:353 INFO wss://HOSTNAME/api/v4/websocket?connection_id=&sequence_number=0 got connection id  ywnqh9ck1bnddfswpdgbj94dga
2024/02/25 14:51:41:569 INFO WEBSOCKET RECONNECT MODELS BATCHING TOOK 20ms
2024/02/25 14:51:41:744 DEBUG error on fetchBindings Received invalid response from the server.; JSON could not be serialized because of error:
The data couldn’t be read because it isn’t in the correct format.
2024/02/25 14:51:48:471 INFO channel switch to CHANNEL-NAME CHANNEL-ID 188 ms
2024/02/25 14:51:48:482 INFO Running "Channel
2024/02/25 14:51:48:726 WARNING Handling Javascript error TypeError: Cannot read property 'props' of undefined

This error is located at:
    in MarkdownTable
    in injectIntl(MarkdownTable)
    in renderTable
    in Markdown
    in ConcreteWithObservablesComponent
    in Unknown
    in RCTView
    in Unknown
    in RCTScrollContentView
    in RCTScrollView
    in ScrollView
    in ScrollView
    in RCTView
    in Unknown
    in AnimatedComponent(View)
    in Unknown
    in Message
    in ConcreteWithObservablesComponent
    in Unknown
    in RCTView
    in Unknown
    in RCTView
    in Unknown
    in Body
    in RCTView
    in Unknown
    in RCTView
    in Unknown
    in RCTView
    in Unknown
    in TouchableHighlight
    in Unknown
    in RCTView
    in Unknown
    in Post
    in ConcreteWithObservablesComponent
    in ConcreteWithObservablesComponent
    in Unknown
    in RCTView
    in Unknown
    in VirtualizedListCellContextProvider
    in CellRenderer
    in RCTScrollContentView
    in RCTScrollView
    in ScrollView
    in ScrollView
    in VirtualizedListContextProvider
    in VirtualizedList
    in FlatList
    in AnimatedComponent(FlatList)
    in Unknown
    in PostList
    in ConcreteWithObservablesComponent
    in ConcreteWithObservablesComponent
    in Unknown
    in RNCSafeAreaView
    in Unknown
    in ChannelPostList
    in ConcreteWithObservablesComponent
    in Unknown
    in RCTView
    in Unknown
    in RNCSafeAreaView
    in Unknown
    in RCTView
    in Unknown
    in Suspender
    in Suspense
    in Freeze
    in FreezeScreen
    in Channel
    in ConcreteWithObservablesComponent
    in ServerUrlComponent
    in Unknown
    in ThemeProvider
    in ConcreteWithObservablesComponent
    in ServerUrlProvider
    in IntlProvider
    in UserLocaleProvider
    in ConcreteWithObservablesComponent
    in DeviceInfoProvider
    in DatabaseProvider
    in ServerDatabaseComponent
    in Provider
    in EmmProvider
    in RNCSafeAreaProvider
    in SafeAreaProvider
    in SafeAreaInsets
    in RCTView
    in Unknown
    in GestureHandlerRootView
    in gestureHoc
    in WrappedComponent
    in RCTView
    in Unknown
    in RCTView
    in Unknown
    in AppContainer, js engine: hermes 0
2024/02/25 14:51:48:726 ERROR TypeError: Cannot read property 'props' of undefined

This error is located at:
    in MarkdownTable
    in injectIntl(MarkdownTable)
    in renderTable
    in Markdown
    in ConcreteWithObservablesComponent
    in Unknown
    in RCTView
    in Unknown
    in RCTScrollContentView
    in RCTScrollView
    in ScrollView
    in ScrollView
    in RCTView
    in Unknown
    in AnimatedComponent(View)
    in Unknown
    in Message
    in ConcreteWithObservablesComponent
    in Unknown
    in RCTView
    in Unknown
    in RCTView
    in Unknown
    in Body
    in RCTView
    in Unknown
    in RCTView
    in Unknown
    in RCTView
    in Unknown
    in TouchableHighlight
    in Unknown
    in RCTView
    in Unknown
    in Post
    in ConcreteWithObservablesComponent
    in ConcreteWithObservablesComponent
    in Unknown
    in RCTView
    in Unknown
    in VirtualizedListCellContextProvider
    in CellRenderer
    in RCTScrollContentView
    in RCTScrollView
    in ScrollView
    in ScrollView
    in VirtualizedListContextProvider
    in VirtualizedList
    in FlatList
    in AnimatedComponent(FlatList)
    in Unknown
    in PostList
    in ConcreteWithObservablesComponent
    in ConcreteWithObservablesComponent
    in Unknown
    in RNCSafeAreaView
    in Unknown
    in ChannelPostList
    in ConcreteWithObservablesComponent
    in Unknown
    in RCTView
    in Unknown
    in RNCSafeAreaView
    in Unknown
    in RCTView
    in Unknown
    in Suspender
    in Suspense
    in Freeze
    in FreezeScreen
    in Channel
    in ConcreteWithObservablesComponent
    in ServerUrlComponent
    in Unknown
    in ThemeProvider
    in ConcreteWithObservablesComponent
    in ServerUrlProvider
    in IntlProvider
    in UserLocaleProvider
    in ConcreteWithObservablesComponent
    in DeviceInfoProvider
    in DatabaseProvider
    in ServerDatabaseComponent
    in Provider
    in EmmProvider
    in RNCSafeAreaProvider
    in SafeAreaProvider
    in SafeAreaInsets
    in RCTView
    in Unknown
    in GestureHandlerRootView
    in gestureHoc
    in WrappedComponent
    in RCTView
    in Unknown
    in RCTView
    in Unknown
    in AppContainer, js engine: hermes
2024/02/25 14:51:48:737 WARNING Handling Javascript error {
    componentStack = "\n    in MarkdownTable\n    in injectIntl(MarkdownTable)\n    in renderTable\n    in Markdown\n    in ConcreteWithObservablesComponent\n    in Unknown\n    in RCTView\n    in Unknown\n    in RCTScrollContentView\n    in RCTScrollView\n    in ScrollView\n    in ScrollView\n    in RCTView\n    in Unknown\n    in AnimatedComponent(View)\n    in Unknown\n    in Message\n    in ConcreteWithObservablesComponent\n    in Unknown\n    in RCTView\n    in Unknown\n    in RCTView\n    in Unknown\n    in Body\n    in RCTView\n    in Unknown\n    in RCTView\n    in Unknown\n    in RCTView\n    in Unknown\n    in TouchableHighlight\n    in Unknown\n    in RCTView\n    in Unknown\n    in Post\n    in ConcreteWithObservablesComponent\n    in ConcreteWithObservablesComponent\n    in Unknown\n    in RCTView\n    in Unknown\n    in VirtualizedListCellContextProvider\n    in CellRenderer\n    in RCTScrollContentView\n    in RCTScrollView\n    in ScrollView\n    in ScrollView\n    in VirtualizedListContextProvider\n    in VirtualizedList\n    in FlatList\n    in AnimatedComponent(FlatList)\n    in Unknown\n    in PostList\n    in ConcreteWithObservablesComponent\n    in ConcreteWithObservablesComponent\n    in Unknown\n    in RNCSafeAreaView\n    in Unknown\n    in ChannelPostList\n    in ConcreteWithObservablesComponent\n    in Unknown\n    in RCTView\n    in Unknown\n    in RNCSafeAreaView\n    in Unknown\n    in RCTView\n    in Unknown\n    in Suspender\n    in Suspense\n    in Freeze\n    in FreezeScreen\n    in Channel\n    in ConcreteWithObservablesComponent\n    in ServerUrlComponent\n    in Unknown\n    in ThemeProvider\n    in ConcreteWithObservablesComponent\n    in ServerUrlProvider\n    in IntlProvider\n    in UserLocaleProvider\n    in ConcreteWithObservablesComponent\n    in DeviceInfoProvider\n    in DatabaseProvider\n    in ServerDatabaseComponent\n    in Provider\n    in EmmProvider\n    in RNCSafeAreaProvider\n    in SafeAreaProvider\n    in SafeAreaInsets\n    in RCTView\n    in Unknown\n    in GestureHandlerRootView\n    in gestureHoc\n    in WrappedComponent\n    in RCTView\n    in Unknown\n    in RCTView\n    in Unknown\n    in AppContainer";
    isComponentError = 1;
    jsEngine = hermes;
} 1
amyblais commented 8 months ago

@pyhsieh-cyberbiz Is there any special markdown in any posts in that channel? We have a ticket open where the app crashes when displaying tables https://mattermost.atlassian.net/browse/MM-55972. Could this be what you're seeing?

pyhsieh-cyberbiz commented 8 months ago

@amyblais We do have a bot posting content with Markdown table to the channel regularly! Pasting one of the recent posts to another channel will trigger the error as well, but unlike MM-55972's case, we don't have unwanted blanks in the second header line, and we don't have empty cell in the table, neither. (Also, we didn't see any strange part in the post on web/desktop application)

Due to privacy issue we can't provide the content directly, but we'll figure out some minimum example with similar format later on.

pyhsieh-cyberbiz commented 8 months ago

@amyblais After few tests, we found that mobile version has different (default?) length limit on posts, which is lower compared to desktop/web version. When mobile app process a post that's longer than the limit, seems that it will cut off excessive text before parsing step. So any error could happen on processing incomplete table Markdown in the content.

If fortunate enough, the parser will still make it, and a warning message about post cutoff will show on the post. We're not that lucky but reducing post length (and keep the Markdown table intact) should help.