After using Mattermost Team Edition docker with Unraid all this year, I recently did an update.
Everything went as expected until I logged in using my system admin account.
Instead of loading my last team, the web page said:
“No teams are available to join. Please create a new team or ask your administrator for an invite.”
Then it offers to create a team or go to console
That’s weird.
I went to the console and noticed I could not join any of my teams.
After a little work (using the app), I was able to get into one of the teams, but realized the textbox would not appear. I could only reply to existing conversations.
The log looks unremarkable except this:
{“level”:“error”,“ts”:1618016369.949103,“caller”:“mlog/log.go:247”,“msg”:“Unable to get the channels.”,“path”:“/api/v4/users/me/teams/pbuiyujbkbdmfjc19eb15pcz4y/channels”,“request_id”:“j44p9qq847y55pneathnqp3apr”,“ip_addr”:“192.168.0.174”,“user_id”:“qsh5y3z3d7dzbkngrfpyjmzzth”,“method”:“GET”,“err_where”:“GetChannelsForUser”,“http_code”:500,“err_details”:“failed to get channels with TeamId=pbuiyujbkbdmfjc19eb15pcz4y and UserId=qsh5y3z3d7dzbkngrfpyjmzzth: sql: Scan error on column index 17, name "TotalMsgCountRoot": converting NULL to int64 is unsupported”}
{"level":"error","ts":1619289009.2911267,"caller":"mlog/log.go:251","msg":"Unable to get the channels.","path":"/api/v4/users/me/teams/pbuiyujbkbdmfjc19eb15pcz4y/channels","request_id":"qgjf6d5qi3y63dnpyzz4hbx7ka","ip_addr":"172.17.0.1","user_id":"4fgmpawr6j8huxd6wwz5615kbo","method":"GET","err_where":"GetChannelsForUser","http_code":500,"err_details":"failed to get channels with TeamId=pbuiyujbkbdmfjc19eb15pcz4y and UserId=4fgmpawr6j8huxd6wwz5615kbo: sql: Scan error on column index 17, name \"TotalMsgCountRoot\": converting NULL to int64 is unsupported"}
I was able to roll back mattermost to 5.34.3. And everything is back to normal.
So I now know the issue is clearly 5.35.
But a new problem has emerged.
If I go into the sytem console I can only access teams and plugins sections. Every other function is missing.
The error log has this:
{"level":"debug","ts":1620343742.3338225,"caller":"mlog/log.go:211","msg":"You do not have the appropriate permissions.","path":"/api/v4/config/environment","request_id":"c1u9pnj86iy3pm519qirrfoyfo","ip_addr":"172.17.0.1","user_id":"qsh5y3z3d7dzbkngrfpyjmzzth","method":"GET","err_where":"Permissions","http_code":403,"err_details":"userId=qsh5y3z3d7dzbkngrfpyjmzzth, permission=sysconsole_read_environment,"}
Since you mentioned that you do not have access to the System Console, it could mean that your account is not assigned to the right role. Can you please run the following command and share the result that you are getting?
SELECT Username, Roles FROM Users WHERE Username = "<Username>";
For example, this is how it looks like from my end for the user I used to set up Mattermost:
mysql> SELECT Username, Roles FROM Users WHERE Username = "ahmad.danial";
+--------------+--------------------------+
| Username | Roles |
+--------------+--------------------------+
| ahmad.danial | system_admin system_user |
+--------------+--------------------------+
1 row in set (0.00 sec)
As you can see over here, this account is assigned to the system_admin and system_user account. When we check this through the database, we can verify the following:
Looking at the system_admin role, we can see the sysconsole_read_environment (among many other sysconsole permission) that is essential for a System Administrator.
I went through the list of roles for the System Admin and clearly, the sysconsole_read_environment (specifically) is missing from it which explains why you are unable to see the System Console from the UI.
Can you run an SQL UPDATE query to include that role into the system_admin role? I would recommend you to backup the database first before you do this.
Strike that last comment, I was able to figure out how to add the missing permission and it did fix this problem.
But there must be two permissions missing because “About” and “Reporting” sections are not viewable.
UPDATE: With a little work and trial and error, I was able to repair the missing sections of the database role. Everything is working as expected. Will remain on 5.34.2 until other issues are fixed.