Mattermost Peer-to-Peer Forum

[SOLVED] Unable to open Mattermost 3.10 (with GitLab 9.3 release): `TypeError: Cannot read property 'substring' of undefined`


#1

After the update to Mattermost 3.10 (with the Gtilab 9.3 release) I’m not able to open the Mattermost UI anymore. I get the following JS error:

team_button.jsx:55 Uncaught (in promise) TypeError: Cannot read property 'substring' of undefined
    at t.value (team_button.jsx:55)
    at d._renderValidatedComponentWithoutOwnerOrContext (ReactCompositeComponent.js:803)
    at d._renderValidatedComponent (ReactCompositeComponent.js:826)
    at d.performInitialMount (ReactCompositeComponent.js:366)
    at d.mountComponent (ReactCompositeComponent.js:262)
    at Object.mountComponent (ReactReconciler.js:50)
    at h.mountChildren (ReactMultiChild.js:242)
    at h._createInitialChildren (ReactDOMComponent.js:701)
    at h.mountComponent (ReactDOMComponent.js:520)
    at Object.mountComponent (ReactReconciler.js:50)

I am the admin of the Mattermost server and team. Other users don’t see this issue.


#2

Hi @chhitz,

what browser/version are you using? what OS? cause if I understand correctly this is happening only to you in your org, have you tried in different browsers?


#3

I did try different browsers and all of them showed the same behavior. My guess is that all other users do not have the rights to create new teams on the server so they wont see the team sidebar.

For now I have “fixed” my issue by commenting the “.substring(0,2)” in https://github.com/mattermost/platform/blob/master/webapp/components/team_sidebar/components/team_button.jsx#L55
With this I am at least able to see the normal chat. The team side bar now looks like this:

When I try to open the System Console I still the the following error:

admin_navbar_dropdown.jsx:89 Uncaught TypeError: Cannot read property 'name' of undefined
    at n.value (admin_navbar_dropdown.jsx:89)
    at d._renderValidatedComponentWithoutOwnerOrContext (ReactCompositeComponent.js:803)
    at d._renderValidatedComponent (ReactCompositeComponent.js:826)
    at d.performInitialMount (ReactCompositeComponent.js:366)
    at d.mountComponent (ReactCompositeComponent.js:262)
    at Object.mountComponent (ReactReconciler.js:50)
    at h.mountChildren (ReactMultiChild.js:242)
    at h._createInitialChildren (ReactDOMComponent.js:701)
    at h.mountComponent (ReactDOMComponent.js:520)
    at Object.mountComponent (ReactReconciler.js:50)

#4

I’m also seeing this issue with one of the users we imported from Slack. We have dozens of users who have transitioned successfully.


#5

I dug around in the database a bit and found that the user affected was still a member of a channel which belonged to a deleted team. Deleting the channelusers entry for the channel in question solved the problem.


#6

Thanks for the hint. This fixes the issues for me as well.


#7

Hi @dfcowell and @chhitz,

Thanks for your feedback with this issue dfcowell :slight_smile: It seems both your and chhitz's problem is solved so I’ll close off this issue for now.

Feel free to reopen if you still experience problems!


#8

It seems that this not the only problem to be fixed. Going into the system console is still impossible. In the end I started looking into the database to search for anything that had to do with teams. I know https://docs.mattermost.com/install/troubleshooting.html#do-not-manipulate-the-mattermost-database but what else to do?

In the database I found 16 unknown teams in my case:

select id, teamid, name from channels where not teamid=’’ and teamid not in (select id from teams) order by teamid, name;

I did not track down where MM selects the list of teams, but I now assume the channels-table is used. This explains the undefined name in javascript.

USE BELOW FIX AT YOUR OWN RISK! I’m not explaining how to get to the database, so I’m sure you know what you do. I did a reconfigure and the problem did not come back. If this doesn’t work, it could be that you also need to clean up the teams form other tables - that’s what I tried before. Make sure you made a backup with pg_dump:

delete from channels where not teamid=’’ and teamid not in (select id from teams);

Still an open question. There are also these entries:

select id, teamid, name, substring(name from 1 for 26), substring(name from 29 for 26) from channels where teamid=’’;

Anybody have an idea if these would need attention now?