Restore fails when including S3 uploads

I am using S3 successfully for both file uploads and backups. But restore will only succeed if I exclude uploads in the backup via “Yes (do not include uploads)”. If I just choose Yes when backing up and include uploads then I get an error in the log:

EXCEPTION: Some uploads could not be migrated to the new scheme. You need to fix this manually.
[2022-08-18 20:57:23] /var/www/discourse/lib/file_store/to_s3_migration.rb:156:in `migrate_to_s3’

I’d like the backups to be entirely self-contained and include uploads so I can restore everything from a backup in case I need to migrate everything to another AWS account, some unforeseen disaster or some such event in the future.

@serios Were you able to fix this issue ? I am also seeing the same issue in my environment.

It’s hard. The issue is that some images are on some other bucket with some other path and that causes the test to fail, so you need to find those uploads and get them on the proper bucket.

Yes…We are working on migrating discourse to different environment …which includes migrating the app to different host and also migrating uploads to a different S3 bucket. We were able to setup the app and enable s3 uploads to new bucket. All new posts and uploads work fine. We are trying to restore the backup from old host into the new host and that is when we are getting this error. Have been struggling with this for past 2 weeks. I see the recommendation is to disable s3 uploads , restore and then enable s3 upload.

I am ready to do that, just wanted to make sure if I disable s3 , restore and enable s3, all the restored uploads will be automatically pushed to new S3 or should we run the s3 migration task ?

If you enable the new S3 settings before you restore they should get pushed to the new bucket when it restores.