# Missing uploads after S3 → S3 migration

**URL:** https://meta.discourse.org/t/missing-uploads-after-s3-s3-migration/227195
**Category:** Support
**Created:** [May 16, 2022, 11:43am UTC](https://meta.discourse.org/t/missing-uploads-after-s3-s3-migration/227195 "2022-05-16T11:43:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![domstubbs](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@domstubbs](https://meta.discourse.org/u/domstubbs)
#### Post date: [May 16, 2022, 11:43am UTC](https://meta.discourse.org/t/missing-uploads-after-s3-s3-migration/227195/1 "2022-05-16T11:43:54Z")

</div>

I’ve migrated uploads from one S3 bucket to another following the tips [suggested here](https://meta.discourse.org/t/how-do-i-move-my-s3-upload-bucket-from-one-provider-to-another/178484/7) and, with the added assistance of `uploads:recover_from_tombstone` and `posts:rebake`, I have pretty much everything working again – but not everything.

I’m not a Ruby dev so my ability to debug is limited. When I run `uploads:recover` now it gives me lots of output like this:

> Warning /t/foo/489/5 had an incorrect 4ff3ad05b76e1888161f41fd86da66efc16c290c should be 0b029ef3549e72dd5e3498abc7f979736d279a5e storing in custom field ‘rake uploads:fix\_relative\_upload\_links’ can fix this  
> Warning /t/bar/498/4 had an incorrect 0649edb23196a8c84a9d71c04147bd8f0c96d0f7 should be f5b4e4bb3eedcd0fb83a06eecc4920f20c5e2bc4 storing in custom field ‘rake uploads:fix\_relative\_upload\_links’ can fix this  
> Warning /t/bar/498/4 had an incorrect 0649edb23196a8c84a9d71c04147bd8f0c96d0f7 should be f5b4e4bb3eedcd0fb83a06eecc4920f20c5e2bc4 storing in custom field ‘rake uploads:fix\_relative\_upload\_links’ can fix this

These warnings do seem to correspond to posts with broken uploads, so it sounds fairly promising. However, when I run `fix_relative_upload_links`, it doesn’t seem to do anything.

```plaintext
rake uploads:fix_relative_upload_links --trace
** Invoke uploads:fix_relative_upload_links (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute uploads:fix_relative_upload_links
skipping missing upload in https://foo.com/t/bar/7/2 <img src="/uploads/default/35/f450f88541e87c52.png" width="198" height="70">
skipping missing upload in https://foo.com/t/bar/7/2 <img src="/uploads/default/36/0b73d33d9df37a66.png" width="120" height="43">

```

(I think the two skipped files are ancient pre-S3 uploads. There’s no output at all for the S3 uploads that generated the prior warnings.)

There’s a report of a [similar issue](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/64) from a year ago but I can’t see any similar reports which include a fix.

I appreciate I’m not doing something that’s officially supported, but any pointers would be appreciated.

I only spotted this issue a few days after the migration. Had I spotted it immediately I’d have tried re-migrating using a fresh DB/S3 restore, but since I don’t want to lose any recent posts I’ll have to work with the live site from here on out.

Thanks.

Edit: I’ve also now tried [converting](https://meta.discourse.org/t/converting-short-upload-urls-to-full-urls/131760) the broken `upload://` URLs and comparing them against records in the uploads table and I’m not really any the wiser.

When I inspect a working `upload://` URL it maps to an `uploads` table record with a valid URL, but when I inspect a broken one it… also maps to a record with a valid URL. It seems as though there is valid data in the DB and the files do exist on S3 at the URL assigned in the uploads table. I can access the S3 URLs in my browser without issue, so I’ve no idea why they’re failing to pull through.
