After rebuilding, avatar photos are missing

I rebuilt from the command line yesterday and today I noticed that many user avatar pictures are missing (similar to this topic back in 2019).

I tried running rake avatars:refresh but the issue remains.

1 Like

Still an issue 2 days later?

1 Like

@codinghorror Yes, even discobot:

CleanShot 2022-01-14 at 20.50.15@2x

It basically affects all users who uploaded a picture (not using gravatar) two years ago, before I switched from local uploads to S3. For some reason, it only broke after last build.

At some point uploads moved from uploads to uploads/default. I’m having a slightly differennt issue with that on another site that’s related to this.

You’d look in the database at the URL for those broken uploads. . . and something. I’m not quite sure. If only I were in Barcelona.

2 Likes

Thanks, Jay. We’re getting closer. I checked four avatar urls and noticed that the URLs of the two that work and the two that don’t (in blue) start with different domains:

CleanShot 2022-01-14 at 21.28.02

The actual URLs I see in the website are different though:

https://MY_DOMAIN/user_avatar/MY_DOMAIN/USERNAME/75/USER_ID_2.png

I’d like to try replacing the prefix before .amazonaws.com but I’m not sure if that’s a good idea (or how to do it).

In case it’s relevant, I’m also using Cloudfront as the S3 CDN.

1 Like

That blue domain is what we use in our hosting. Have you moved away from our hosting at any point? If so you must update that to reflect your new bucket.

3 Likes

Yes, that must be it.

But how and what should I change exactly? Since the images are no longer accessible, I can’t re-upload them. Or maybe I can get them from an old backup, and re-upload them via the API

1 Like

When moving buckets you need to run a remap with Replace a string in all posts.

Of course, you need the files to be in the new bucket first :sweat_smile:. If they are in an old backup you have, you should sync those up with the bucket.

3 Likes

Just hypothetically, :sweat_smile: do I have another option if I don’t have a backup of those S3 assets? I’m having trouble finding it.

Does discourse-cloud-file-uploads keep versions/cache somewhere?

1 Like

We keep those files during active subscriptions and only for a few days after you cancel.

1 Like

Thanks, Rafael.

  1. If when I extract one of my old backups I only see a dump.sql file, does that mean it doesn’t include uploads? I’m pretty sure I had the backup with uploads setting, since it’s turned on by default.

  2. I can see I have almost 10 GB of uploaded files (in /admin dashboard). Is there a way to access these from the command line? I looked in /var/discourse/shared/standalone/uploads/ but it only takes up 11MB.

  3. Is there anywhere else I could look or should I consider these files gone forever?

there is a site setting backup with uploads. You might try that.

1 Like

Thanks, Jay.

I already had that setting enabled back in 2019 when my users uploaded their avatars. Then I switched to S3 in 2020 and just last week all the 2019 avatars got lost. I’m trying to find out a way to recover them because my old backups seem to be just dump.sql files without uploads.

Sorry, I’d lost the context of your message when I replied. I think the dashboard is referring to the S3 uploads not local files.

If those avatars were in discourse.org's S3 bucket then they are gone. If you migrated from them and got a backup after you canceled your account, you’d get a full backup with the uploads. Do you have any backups that are bigger and/or .tar.gz files?

It sounds lke you’ve been pointing at discourse.org assets and they are gone.

The biggest 2019 backup I have is 59 MB, but when I extract it I just get a 217MB dump.sql file :sweat_smile:

I’m very sorry. It sounds like migrated from discourse.org without getting your uploads.

1 Like

Lesson learned. :sweat_smile: Thanks, anyway

1 Like