Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set new user Avatar via file upload #7470

Closed
wohali opened this issue Jul 11, 2017 · 17 comments
Closed

Cannot set new user Avatar via file upload #7470

wohali opened this issue Jul 11, 2017 · 17 comments
Assignees

Comments

@wohali
Copy link

wohali commented Jul 11, 2017

Rocket.Chat Version: 0.57.1 (Dockerized)
Running Instances: 1
DB Replicaset OpLog: Disabled
Node Version: v4.8.1

History: We upgraded from 0.56 -> 0.57.1 (no RCs) via docker pull and avatars failed to migrate. I applied the workaround from #7172 (AVATARS_PATH=/app/uploads and MIGRATION_VERSION=99,rerun) and was able to get avatars to migrate correctly. We are using FileSystem for File Upload Storage Type.

Now: Users cannot change their avatar using My Account > Avatar > Select File/Use Uploaded Avatar.
File uploads do work for all users (tested with paperclip attachment.) In fact, the file upload correctly places the new file in the mapped /app/uploads path (confirmed with ls on the server).

Worse, the web interface displays the green "Avatar changed successfully" popup, but after returning to the chat screen, no new avatar is displayed, even after force-reloading or clearing the cache browser. Reloading the My Account > Avatar page then shows the default "disk with up arrow" icon for a user's avatar instead. The user's avatar from before upload continues to display in chat windows.

Worse, from the Rocket.Chat desktop or mobile app, clicking the "Use Uploaded Avatar" button appears to do nothing. No green popup is displayed, and no change happens.

Avatars can right now be changed via the "Use URL for Avatar" button.

There are no errors displayed in our Rocket.Chat server log:

[34mI20170707-16:24:38.372(0) Will load cache for users 
�[34mI20170707-16:24:38.507(0) 240 records load from users 
�[34mI20170707-16:24:38.509(0) Will load cache for rocketchat_room 
�[34mI20170707-16:24:38.552(0) 127 records load from rocketchat_room 
�[34mI20170707-16:24:38.554(0) Will load cache for rocketchat_subscription 
�[34mI20170707-16:24:38.874(0) 771 records load from rocketchat_subscription 
�[34mI20170707-16:24:38.874(0) Will load cache for rocketchat_settings 
�[34mI20170707-16:24:38.938(0) 516 records load from rocketchat_settings 
�[34mI20170707-16:24:40.777(0) Updating process.env.MAIL_URL 
�[34mI20170707-16:24:43.975(0) Will load cache for rocketchat_permissions 
�[34mI20170707-16:24:43.982(0) 71 records load from rocketchat_permissions 
�[34mI20170707-16:24:43.989(0) Will load cache for rocketchat_roles 
�[34mI20170707-16:24:43.991(0) 10 records load from rocketchat_roles 
�[34mI20170707-16:24:47.384(0) Setting default file store to FileSystem 
�[34mI20170707-16:24:50.334(0) (rocketchat_migrations.js:147) Migrations: Not migrating, already at version 99
�[34mI20170707-16:24:50.864(0) Updating process.env.MAIL_URL 
�[34mI20170707-16:24:52.305(0) �[32mUsing GridFS for custom sounds storage 
�[34mI20170707-16:24:52.356(0) �[32mUsing GridFS for custom emoji storage 
�[34mI20170707-16:24:52.361(0) ufs: temp directory created at "/tmp/ufs" 
�[34mI20170707-16:24:53.690(0) [Fri Jul 07 2017 16:24:53 GMT+0000 (UTC)] WARNING A script has tried registering a HTTP route while the HTTP server is disabled with --disabled-httpd. 
�[34mI20170707-16:24:53.691(0) �[32mLoaded hubot-help/src/help.coffee 
�[34mI20170707-16:24:58.301(0) �[32m➔ �[32mSystem ➔ startup 
�[34mI20170707-16:24:58.301(0) �[32m➔ �[32m+---------------------------------------------------+ 
�[34mI20170707-16:24:58.302(0) �[32m➔ �[32m|                   SERVER RUNNING                  | 
�[34mI20170707-16:24:58.302(0) �[32m➔ �[32m+---------------------------------------------------+ 
�[34mI20170707-16:24:58.302(0) �[32m➔ �[32m|                                                   | 
�[34mI20170707-16:24:58.302(0) �[32m➔ �[32m|  Rocket.Chat Version: 0.57.1                      | 
�[34mI20170707-16:24:58.303(0) �[32m➔ �[32m|       NodeJS Version: 4.8.1 - x64                 | 
�[34mI20170707-16:24:58.303(0) �[32m➔ �[32m|             Platform: linux                       | 
�[34mI20170707-16:24:58.303(0) �[32m➔ �[32m|         Process Port: 3000                        | 
�[34mI20170707-16:24:58.304(0) �[32m➔ �[32m|             Site URL: https://<CENSORED>  | 
�[34mI20170707-16:24:58.304(0) �[32m➔ �[32m|     ReplicaSet OpLog: Disabled                    | 
�[34mI20170707-16:24:58.304(0) �[32m➔ �[32m|          Commit Hash: 0c0fa2a8af                  | 
�[34mI20170707-16:24:58.304(0) �[32m➔ �[32m|        Commit Branch: HEAD                        | 
�[34mI20170707-16:24:58.305(0) �[32m➔ �[32m|                                                   | 
�[34mI20170707-16:24:58.305(0) �[32m➔ �[32m+---------------------------------------------------+ 
@tholu
Copy link
Contributor

tholu commented Jul 15, 2017

Similar problem here, switched to Gravatar for all users as a temporary solution.

@graywolf336
Copy link
Contributor

@rodrigok this is an issue with the file upload changes.

@geekgonecrazy
Copy link
Member

@tholu @wohali can you guys both try 0.57.2 as it contains fixes related to this. Please let us know if this is still an issue with 0.57.2

@wohali
Copy link
Author

wohali commented Aug 1, 2017

@geekgonecrazy We are on 0.57.2 and the problem persists, exactly as originally reported. The "Use Uploaded Avatar" button in the desktop client does nothing. With the web client, running under Chrome, I get the green "Avatar changed successfully" notification, but the avatar does not change - until I forcibly reload the entire client, then it does.

So perhaps the issue is now a bug with the Electron client?

@geekgonecrazy
Copy link
Member

@rodrigok sounds like we have another edge case. I'm not sure what info you'd need to track this one down

@tholu
Copy link
Contributor

tholu commented Aug 1, 2017

The avatar issue was not solved with 0.57.2 for us (avatars were not displayed, did not do much more testing though - we switched to Gravatar for all users).

@mestaritonttu
Copy link

Which version is https://demo.rocket.chat/ running? I was not able to change my avatar from the auto-fetched gravatar to a file upload. It gave the "avatar changed successfully", but it didn't change. Avatar from url worked.

@geekgonecrazy
Copy link
Member

@mestaritonttu we are currently on 0.58.0-rc.0 on the community server.

@wcgcoder
Copy link

wcgcoder commented Aug 8, 2017

@geekgonecrazy Checking in here saying on 0.57.2 we have the problem in Safari for sure, but Chrome works fine, today.
JS Error in Safari when clicking "Use uploaded Avatar":

[Error] TypeError: l[d.iterator] is not a function. (In 'l[d.iterator]()', 'l[d.iterator]' is undefined)
	click .select-service (3bb2a7c7e9c2458b6ad87f3bedebb604d8fc2a6f.js:308:6460)
	(anonymous function) (3bb2a7c7e9c2458b6ad87f3bedebb604d8fc2a6f.js:140:6072)
	_withTemplateInstanceFunc (3bb2a7c7e9c2458b6ad87f3bedebb604d8fc2a6f.js:140:5647)
	(anonymous function) (3bb2a7c7e9c2458b6ad87f3bedebb604d8fc2a6f.js:140:6044)
	(anonymous function) (3bb2a7c7e9c2458b6ad87f3bedebb604d8fc2a6f.js:139:26989)
	_withCurrentView (3bb2a7c7e9c2458b6ad87f3bedebb604d8fc2a6f.js:139:23067)
	(anonymous function) (3bb2a7c7e9c2458b6ad87f3bedebb604d8fc2a6f.js:139:26961)
	(anonymous function) (3bb2a7c7e9c2458b6ad87f3bedebb604d8fc2a6f.js:139:9130)
	dispatch (3bb2a7c7e9c2458b6ad87f3bedebb604d8fc2a6f.js:53:13727)

@d-sko
Copy link
Contributor

d-sko commented Aug 22, 2017

I've noticed that the Avatar image is actually updated, but the old one is loaded from cache. The Avatar URL is /avatar/<Username>?_dc=undefined ... _dc should not be undefined, right?

@wcgcoder
Copy link

wcgcoder commented Sep 5, 2017

Verified that in version 0.58.2, Safari is no longer a problem, though a page refresh is still required in order to see the updated avatar.

@acki
Copy link

acki commented Mar 21, 2018

Still can't upload new avatar in Version 0.59.3 - even a reload gives me the default image with the letters AC.
Tested with Firefox and Safari

@geekgonecrazy
Copy link
Member

Please try on newer version. A lot has changed related to avatars. Actually 0.63 will be released soon, and it has even more fixes

@derN3rd
Copy link

derN3rd commented Aug 21, 2018

This issue still exists for me on 0.68.4

<img src="/avatar/derN3rd?_dc=undefined" class="avatar-image">

Rocket.Chat Version: 0.68.4
NodeJS Version: 8.11.3 - x64
Platform: linux
ReplicaSet OpLog: Disabled
Commit Hash: 200a6b01a1
Commit Branch: HEAD

@artworkad
Copy link

Have this issue @0.69.1 @geekgonecrazy please reopen since this issue is still present

@Elfe
Copy link

Elfe commented Sep 21, 2018

Hi,

I see some issues with downloading some avatar images.

curl -s -I https://host.tld/avatar/username?_dc=12345
HTTP/1.1 200 OK
Server: nginx/1.10.3
Date: Fri, 21 Sep 2018 11:00:06 GMT
Content-Type: image/jpeg)
Content-Length: 6454
Connection: keep-alive
X-Instance-ID: 2tHt3DwMJu4mKqNiJ
X-Powered-By: Express
Access-Control-Allow-Origin: *
Content-Security-Policy: default-src 'none'
Cache-Control: public, max-age=3600

The dc= value should not be a big problem as the cache should expire after 3600 seconds anyway.
But it appears that the Content-Type header is broken on some old uploads.

Content-Type: image/jpeg)

I don't think that forcing the users to upload their avatars again would be a good solution on this one.

@artworkad
Copy link

Have this issue @0.69.1 @geekgonecrazy please reopen since this issue is still present

Works for me now. I am using google cloud storage and the service account permission had to be set to Storage-Object-Administrator instead of just "Object-Creator and Object-Viewer"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests