Unable to view or upload images

I recently migrated my forum from one server to another. Current version is 2.6.0.beta2 Everything else is working fine, however, the previously uploaded images are not visible as well as users are unable to upload new images. Also, users are not able to update their profile pictures.

I tried a few things that were mentioned in this forum, however, none seemed to work for me. Need help!

1 Like

Were you previously using s3 or some similar s3-compatible storage?

What necessitated the change? How are the servers different and how was the new server built?


I have never used S3 on this server, even for testing.

I had to change the server because I wanted to change the region. The new server is identical to the old server in every way, except for the region. I was using cloudfront CDN but after migration I invalidated the complete cache.

I can see the old images are available on the new server as they were included with the backup, but still this issue.

Did you upgrade the old instance to the same level prior to making/restoring the backup?

Yes, everything was identical in both the servers. I followed proper steps for migration, and also checked issues faced by other users during migration.

The problem is not just that I’m not able to view old images, users are not able to upload new images too. I guess it is a problem with some image driver (sorry for the vague guess).

And this is using the standard install?

Yes, with the steps mentioned at https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md

Ok, so to recap, your old server was on the standard install. You’ve reinstalled on a system built in the same way, and restored the backup.

If you look at the source of a page what do the image URLs look like? How does that compare to the the uploads in /var/discourse/standalone/web-only/uploads/default ?

What happens if you try to open an image link directly?

Were either of these installations two-container?

Recategorizing from #bug to #support because there aren’t any clear steps to reproduce. Once we can identify the root cause it may need to be filed as a bug, but that isn’t the case at present.

Looks like the images for my forum are uploaded in /var/discourse/shared/standalone/uploads/default/optimized/1X. There are many images stored with multiple resolutions, however, the image file name on the forum and in the directory are not same.

I get 404 code for https://forumcdn.domain.com/uploads/default/optimized/1X/55cfd1bf40edcb3ac19d3e412a5ad63f93c0a854_2_225x250.png but when I replace the image file name with a file name from the directory, it works. All the image files are intact and can be viewed when opened directly, it is just that the file names on the forum are different.

Is include thumbnails in backups enabled on the source instance?

If not:

Include generated thumbnails in backups. Disabling this will make backups smaller, but requires a rebake of all posts after a restore.

Which means you will need to rake posts:rebake

1 Like

include thumbnails in backups was disabled on the source instance. I just ran rake posts:rebake inside the discourse container and I got the following result:

root@vps-app:/var/www/discourse# rake posts:rebake
Rebaking post markdown for 'default'
      628 / 628 (100.0%)
628 posts done!

To be double sure, I invalidated the CDN cache but still I’m unable to view any images. Also, I’m unable to upload any images so I doubt this solution can solve that issue.

1 Like