mattermost / mattermost-plugin-zoom

Zoom plugin for Mattermost :electric_plug:
Apache License 2.0
107 stars 68 forks source link

Webapp crashes when a new user select an option from the PMI setting option for the first time #349

Closed raghavaggarwal2308 closed 4 months ago

raghavaggarwal2308 commented 5 months ago

Summary

Note: This behavior is only observed on the newer version of MM (Tested on v9.0.0) and it is working fine on the older version (Tested on v5.37.0). This makes us think that this might be some issue in the mattermost webapp code.

Error message in console:

[Util] handleError::  Uncaught TypeError: Cannot read properties of undefined (reading 'team_id')

Screenshots

We selected the "No" option in the response below. image Webapp crashed image After refreshing (The setting was updated) image API call to fetch channel details image image

Steps to reproduce:

  1. Create a new user on MM latest version.
  2. Connect your Zoom account.
  3. Run the /zoom settings command.
  4. Click on one of the options from the response.
mickmister commented 5 months ago

[Util] handleError:: Uncaught TypeError: Cannot read properties of undefined (reading 'team_id')

This error essentially says "I tried to read from an undefined object, and team_id happened to be the property I tried to access from this undefined object". So it's not that team_id is blank, it's that the channel object we're querying is undefined. The team_id being blank is normal for DMs and GMs.

The issue makes me think there's something different about the redux store or about one of the plugin registry functions. Are you able to trace the code in the zoom plugin to see where the error is occurring? It's going to be a function in mattermost-redux likely, but we need to know the call stack from the plugin source code to that level. I see it's also happening with the gitlab plugin as well, so this indeed points to an issue in the webapp code. One thing we'll want to figure out is the version of Mattermost that introduced the issue, so we can then tell the webapp team what needs to be investigated.

raghavaggarwal2308 commented 5 months ago

The issue makes me think there's something different about the redux store or about one of the plugin registry functions. Are you able to trace the code in the zoom plugin to see where the error is occurring?

@mickmister I tried adding the print statements in the code of the API called after clicking on the button but everything seemed to be working fine. Also, this is a mattermost interactive message so the plugin's webapp is not included in that

mickmister commented 5 months ago

Can you make sure you run make deploy with the following env vars? I think this may make the console stack traces more useful

MM_SERVICESETTINGS_ENABLEDEVELOPER=true
MM_DEBUG=1
raghavaggarwal2308 commented 5 months ago

Can you make sure you run make deploy with the following env vars? I think this may make the console stack traces more useful

MM_SERVICESETTINGS_ENABLEDEVELOPER=true
MM_DEBUG=1

@mickmister Tried this, still getting the same errors in the console. image

ayusht2810 commented 5 months ago

@mickmister I tried reproducing the above issue on various cloud servers. I was able to run the command /zoom settings on v6.3.0, v7.8.10 and the webapp crash occurred on servers like v8.0.0, v8.1.11, v9.4.0.

mickmister commented 5 months ago

@raghavaggarwal2308 Okay maybe we can hop on a call to debug this. We can meet before our team meeting tomorrow if that works

ayusht2810 commented 5 months ago

@mickmister Sure, sent you an invite. Let me know if it is fine with you.

hmhealey commented 5 months ago

I did a bit of investigating into this which I posted about here: https://community.mattermost.com/core/pl/zw4zxkubhffsjrtt8n6gmf33by

It seems like an error occurs the first time a user clicks that button, and the Zoom bot DMs you that error. The message it sends is in a newly created DM chanel which isn't loaded by the web app at that point, but that wouldn't normally matter unless the post is rendered. The crash comes from the web app trying to render the error message post despite it being in a different, unloaded channel which is incredibly bizarre

ayusht2810 commented 4 months ago

More details can be found here: https://hub.mattermost.com/partners/pl/hax98r87kjda3q8q5tfcrsptto