RocketChat / Rocket.Chat

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

[6.3.3] Updating user profile image fails #30330

Open svenseeberg opened 1 year ago

svenseeberg commented 1 year ago

Description:

When trying to set a new profile image via the web interface (https://rocketchat.example.com/account/profile), the application fails to set the new image when clicking the save button. A notification Internal server error appears.

The network tab of both Firefox and Chromium do not even show a submitted network request. There is also no error in the browser console. That means beyond the obviously wrong message (no request was ever sent to the server), there is not much to go on.

Updating the profile image via the Android app works without any issues.

There is one error in the browser console when opening the profile page:

image

Steps to reproduce:

  1. Open the path /account/profile on your server
  2. Select a new profile image from you local file system
  3. Hit the save button
  4. See the Internal server error message in the upper right corner

Expected behavior:

Show a better error message and work in the end.

Actual behavior:

image

Server Setup Information:

Client Setup Information

Additional context

I'm operating multiple Rocket.Chat servers on the same version with the same Nginx and MongoDB versions (exactly the same, all deployed from the same configuration templates). This happens only on one of them. The main difference: the one that breaks uses a SAML login. I do not expect that this is relevant, but could be.

Relevant logs:

None at all that would be directly related to the error message.

Aadarshprajapati777 commented 1 year ago

hey @svenseeberg , I am also facing error while updating my profile picture on https://rocketchat.example.com/account/profile in my pc but it is working properly on my friend's laptop. I cloned and fixed the bug in the code on my local development server and profile updating is now working on my local machine. I will send pull request.

Gummikavalier commented 1 year ago

For the reference profile avatar uploads work with Custom Oauth-based accounts for us.

Some avatar-upload issues are familiar to me from the past. Since you are using tar based installation also check that /tmp/ufs directory exists on the server and that it is owned by the account that runs the node/rocketchat process. Sometimes RC fails to create this directory during the start.

svenseeberg commented 1 year ago

Some avatar-upload issues are familiar to me from the past. Since you are using tar based installation also check that /tmp/ufs directory exists on the server and that it is owned by the account that runs the node/rocketchat process. Sometimes RC fails to create this directory during the start.

As mentioned: setting the image via the Android app works w/o issues. Also, no network request is sent to the server at all. I don't think that there is anything relevant on the server side. It seems to be a bug in the front end. The problem is, that even the error message is wrong.

Itsamanjain commented 1 year ago

I want to get started with this repository. How do I get started?

Gummikavalier commented 1 year ago

As mentioned: setting the image via the Android app works w/o issues. Also, no network request is sent to the server at all. I don't think that there is anything relevant on the server side. It seems to be a bug in the front end. The problem is, that even the error message is wrong.

Good point. So far the difference would be SAML then. In relation to that does uploading avatar with a local account work?

svenseeberg commented 1 year ago

In relation to that does uploading avatar with a local account work?

Good idea! Yes indeed, local accounts can change their profile picture.

Gummikavalier commented 1 year ago

At least the case clearly points at SAML, which is good for the devs to troubleshoot it.

Further troubleshooting I'd do at this point would be:

  1. Elevating one SAML provisioned user to admin and then trying to chang the profile avatar again as this user.

Should that succeed, then

  1. Creating a role and assigning that role all the same privileges that admin has. Then trying again, and then removing permissions from that role in bunches of 10 - 20, and then one by one, to figure out what privilege triggers the error.
svenseeberg commented 1 year ago

Elevating one SAML provisioned user to admin and then trying to chang the profile avatar again as this user.

My personal user is an SAML account with admin privileges and cannot change the profile image.

Gummikavalier commented 1 year ago

The last stab into the dark that comes to my mind that would not involve SAML directly would be whether this one instance uses different filesystem upload store compared to others. My Oauth test setup does not use GridFS but filesystem directly. There might be a different method for handling permissions between these in RC.

svenseeberg commented 1 year ago

The last stab into the dark that comes to my mind that would not involve SAML directly would be whether this one instance uses different filesystem upload store compared to others.

Good question. In this case all installs are using the same setup: an ext4 partition. But I guess that this would most likely result in an actual server side error? Or does the client know about that in advance?

Gummikavalier commented 1 year ago

Nah, if all compared systems use local filesystem I think the case is clear for that matter. The issue would be with SAML alone, unless someone running SAML can confirm that they don't have the issue and are running with the local filesystem.

Just to get officials eyes on this too; FYI for @hugocostadev that there is likely to be an avatar related issue with SAML provisioned user profiles.