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

Avatar upload to S3 bucket only works when initial avatar is set #15470

Closed
splattner opened this issue Sep 30, 2019 · 9 comments · Fixed by #27060
Closed

Avatar upload to S3 bucket only works when initial avatar is set #15470

splattner opened this issue Sep 30, 2019 · 9 comments · Fixed by #27060

Comments

@splattner
Copy link

Description:

RocketChat is configured to use AmazonS3 (but not with AWS S3 Service) as FileUpload storage type. Setting a new user avatar (upload or gravatar) works when the current avatar is the initial avatar (1st letter of name). When the avatar is set and a user uploads a new avatar, the new avatar is not stored in the S3 bucket and a broken image is shown. MongoDB entry is fine but object does not exist in S3 bucket. Reverting to initial avatar, does remove the MongoDB entry.

Steps to reproduce:

  1. Go to Account / Profile
  2. Set a profile picture (upload one or use gravatar) and save the changes
  3. Profile picture shows a broken Image -> NOK
  4. Change to initial avatar and save changes
  5. Profile Picture shows initial avatar
  6. Set a Profile Picture (upload one or use gravatar) and save the changes
  7. Profile picture shows the new image corrrectly. -> OK

Expected behaviour:

the new user avatar should be store correctly no matter what previous avatar was used

Actual behavior:

MongoDB entry with initial avatar set:

db.rocketchat_avatars.find({name: "splattner"})
# No Result

MongoDB Entry when changing from initial avatar to a new profile picture. S3 Object exists

db.rocketchat_avatars.find({name: "splattner"})
{ "_id" : "YTb345cKGtLrBcGQZ", "userId" : "oEEnfd378rh8H83is", "type" : "image/jpeg", "size" : 5273, "AmazonS3" : { "path" : "4a4C7dfyuCXH4yygw/avatars/oEEnfd378rh8H83is" }, "store" : "AmazonS3:Avatars", "_updatedAt" : ISODate("2019-09-30T12:03:08.529Z"), "instanceId" : "jgvePrpWxRKB3nWvH", "name" : "splattner", "complete" : true, "etag" : "PiNKXiEnMweZzCSZm", "path" : "/ufs/AmazonS3:Avatars/YTb345cKGtLrBcGQZ/undefined", "progress" : 1, "token" : "f8Bbdb292a", "uploadedAt" : ISODate("2019-09-30T12:03:08.642Z"), "uploading" : false, "url" : "https://chat.****/ufs/AmazonS3:Avatars/YTb345cKGtLrBcGQZ/undefined" }

MongoDB after changing profile picture again. S3 Object does not exist

db.rocketchat_avatars.find({name: "splattner"})
{ "_id" : "ipJmTQHT9tSYjaG3a", "userId" : "oEEnfd378rh8H83is", "type" : "image/png", "size" : 4585, "AmazonS3" : { "path" : "4a4C7dfyuCXH4yygw/avatars/oEEnfd378rh8H83is" }, "store" : "AmazonS3:Avatars", "_updatedAt" : ISODate("2019-09-30T12:04:05.906Z"), "instanceId" : "jgvePrpWxRKB3nWvH", "name" : "splattner", "complete" : true, "etag" : "ShuGmnzAookwNSSb3", "path" : "/ufs/AmazonS3:Avatars/ipJmTQHT9tSYjaG3a/undefined", "progress" : 1, "token" : "BB28d80B88", "uploadedAt" : ISODate("2019-09-30T12:04:06.059Z"), "uploading" : false, "url" : "https://chat.****/ufs/AmazonS3:Avatars/ipJmTQHT9tSYjaG3a/undefined" }

Server Setup Information:

  • Version of Rocket.Chat Server: 2.1.0
  • Operating System: CentOS
  • Deployment Method: docker (kubernetes / helm)
  • Number of Running Instances: 2
  • DB Replicaset Oplog: Enabled
  • NodeJS Version: v8.11.4
  • MongoDB Version: v4.0.12

Additional context

Relevant logs:

server.js:212 Meteor ➔ method setAvatarFromService -> userId: oEEnfd378rh8H83is , arguments: [ 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcgSlBFRyB2NjIpLCBxdWFsaXR5ID0gOTAK/9sAQwADAgIDAgIDAwMDBAMDBAUIBQUEBAUKBwcGCAwKDAwLCgsLDQ4SEA0OEQ4LCxAWEBETFBUVFQwPFxgWFBgSFBUU/9sAQwEDBAQFBAUJBQUJFA0LDRQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AA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2Q==',

'image/jpeg',

'gravatar' ]
@splattner splattner changed the title Avatar Upload to S3 Bucket only works when Initial Avatar is set Avatar upload to S3 bucket only works when initial avatar is set Sep 30, 2019
@splattner
Copy link
Author

I just got some S3 logs from our cloud provider, related to this.

For the last described profile image change with the posted mongodb entry where s3 object does not exist:

db.rocketchat_avatars.find({name: "splattner"})
{ "_id" : "ipJmTQHT9tSYjaG3a", "userId" : "oEEnfd378rh8H83is", "type" : "image/png", "size" : 4585, "AmazonS3" : { "path" : "4a4C7dfyuCXH4yygw/avatars/oEEnfd378rh8H83is" }, "store" : "AmazonS3:Avatars", "_updatedAt" : ISODate("2019-09-30T12:04:05.906Z"), "instanceId" : "jgvePrpWxRKB3nWvH", "name" : "splattner", "complete" : true, "etag" : "ShuGmnzAookwNSSb3", "path" : "/ufs/AmazonS3:Avatars/ipJmTQHT9tSYjaG3a/undefined", "progress" : 1, "token" : "BB28d80B88", "uploadedAt" : ISODate("2019-09-30T12:04:06.059Z"), "uploading" : false, "url" : "https://chat.****/ufs/AmazonS3:Avatars/ipJmTQHT9tSYjaG3a/undefined" }

Matched based on "_updatedAt" : ISODate("2019-09-30T12:04:05.906Z" and the posted logs below are the only ones with same timestamp (beaware, different timezone (2h) in logs)

Sep 30 14:04:06 rgw-proxy2 haproxy[1097]: 5.102.151.145:6175 [30/Sep/2019:14:04:06.022] public-frontend~ rgw-backend/rgw1 0/0/0/12/12 200 210 - - ---- 28/28/2/3/0 0/0 -/-/-/- {pitc-rocketchat-prod.***} "PUT /4a4C7dfyuCXH4yygw/avatars/oEEnfd378rh8H83is HTTP/1.1"
Sep 30 14:04:06 rgw-proxy2 haproxy[1097]: 5.102.151.145:62841 [30/Sep/2019:14:04:05.927] public-frontend~ rgw-backend/rgw1 395/0/0/23/418 204 135 - - ---- 27/27/2/3/0 0/0 D/393/4/51.0 {pitc-rocketchat-prod.***} "DELETE /4a4C7dfyuCXH4yygw/avatars/oEEnfd378rh8H83is HTTP/1.1"

it seems the PUT came before DELETE which would explain why the image is not there

@splattner
Copy link
Author

I still see this with version 2.2.0

@balleddog
Copy link

Same here.

  • rocket.chat version : 2.2.0
  • Deployed rocket.chat on premise and used a ceph-oss as a s3-compatible user upload location.

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stat: stale Stale issues will be automatically closed if no activity label Jul 24, 2020
@splattner
Copy link
Author

well, its still broken...

@github-actions github-actions bot removed the stat: stale Stale issues will be automatically closed if no activity label Oct 9, 2020
@pgassmann
Copy link

pgassmann commented Oct 13, 2020

As far as I understand, the file is deleted when avatarsOnFinishUpload wants to delete the old avatar:

// update file record to match user's username
const user = Users.findOneById(file.userId);
const oldAvatar = Avatars.findOneByName(user.username);
if (oldAvatar) {
Avatars.deleteFile(oldAvatar._id);
}
Avatars.updateFileNameById(file._id, user.username);
// console.log('upload finished ->', file);

@pgassmann
Copy link

Workaround is to first set the Avatar to the initial avatar (First Character of your Name). Then Save. And only then upload the new avatar.

@minhtrongtgm
Copy link

Hi guys, is there a final solution for this issue?

@memachado
Copy link

Workaround is to first set the Avatar to the initial avatar (First Character of your Name). Then Save. And only then upload the new avatar.

Same problem, but this workaround does not work

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

Successfully merging a pull request may close this issue.

5 participants