Users report that upgrading to Discourse 2.5.0.beta6 caused images to break, returning 403 Forbidden errors from S3. kkowalczyk notes that S3 returns 403 instead of 404 for missing files, suggesting images may have been deleted. Attempts to recover images using rake uploads:recover_from_tombstone and rake posts:missing_uploads were unsuccessful. The rake uploads:missing command fails with a PostgreSQL syntax error. SweaterVest confirms the same issue. masterakay also reports the problem and references a related thread. The issue appears widespread, with multiple users unable to restore missing images despite trying various recovery methods.
ec89198b693dd221d603373294f36ea14c5c25f1.png:1 GET https://discourse-sumatra-backup.s3.dualstack.us-east-1.amazonaws.com/original/2X/e/ec89198b693dd221d603373294f36ea14c5c25f1.png 403 (Forbidden)
Image (async)
(anonymous) @ _application-f4f68c0db9c527ecb2ed2efb83107d37ca9e6e73caaadc4ab4761618775063f1.js:1
(anonymous) @ _application-f4f68c0db9c527ecb2ed2efb83107d37ca9e6e73caaadc4ab4761618775063f1.js:1
(anonymous) @ _application-f4f68c0db9c527ecb2ed2efb83107d37ca9e6e73caaadc4ab4761618775063f1.js:1
e7cb414e4237ed797a603eeea49d7ed468ac2aee.png:1 GET https://discourse-sumatra-backup.s3.dualstack.us-east-1.amazonaws.com/original/2X/e/e7cb414e4237ed797a603eeea49d7ed468ac2aee.png 403 (Forbidden)
Image (async)
(anonymous) @ _application-f4f68c0db9c527ecb2ed2efb83107d37ca9e6e73caaadc4ab4761618775063f1.js:1
(anonymous) @ _application-f4f68c0db9c527ecb2ed2efb83107d37ca9e6e73caaadc4ab4761618775063f1.js:1
(anonymous) @ _application-f4f68c0db9c527ecb2ed2efb83107d37ca9e6e73caaadc4ab4761618775063f1.js:1
5:1 Error while trying to use the following icon from the Manifest: https://forum.sumatrapdfreader.org/manifest.webmanifest (Download error or resource isn't a valid image)
Unfortunately s3 is lying and seems to return 403 for non-existing files (instead of 404) so it’s more likely the images are no longer in s3 than having their permissions mangled.
To recap: all I did was upgrade Discourse via web interface and many images seem to have been deleted from S3 backup. Example page: No preview in Windows Explorer
Any suggestion on how to re-create / re-upload those images?
Things I’ve tried and didn’t fix it:
rake uploads:recover_from_tombstone
rake posts:missing_uploads
returns:
2 uploads are missing.
2 of 6867 posts are affected.
Clearly much more than 2 images are missing.
rake uploads:missing
Currently it seems to be completely broken:
default has uploads on S3!
validating without inventory is likely to take an enormous amount of time.
We recommend you run SKIP_EXTERNAL=1 rake uploads:missing to skip validating if on a multisite.
rake aborted!
PG::SyntaxError: ERROR: syntax error at end of input
LINE 1: INSERT INTO verified_ids VALUES
^
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.0.2/lib/patches/db/pg.rb:56:in `exec'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.0.2/lib/patches/db/pg.rb:56:in `exec'
/var/www/discourse/lib/file_store/s3_store.rb:290:in `list_missing'
/var/www/discourse/lib/file_store/s3_store.rb:197:in `list_missing_uploads'
/var/www/discourse/lib/tasks/uploads.rake:396:in `list_missing_uploads'
/var/www/discourse/lib/tasks/uploads.rake:389:in `block (2 levels) in <main>'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rails_multisite-2.3.0/lib/rails_multisite/connection_management.rb:68:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rails_multisite-2.3.0/lib/rails_multisite/connection_management.rb:78:in `each_connection'
/var/www/discourse/lib/tasks/uploads.rake:374:in `block in <main>'
/var/www/discourse/lib/tasks/uploads.rake:400:in `block in <main>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => uploads:missing_files
(See full trace by running task with --trace)