A user, Amethi, is experiencing issues with linked images not displaying or appearing broken during a bulk migration of 15k news stories to Discourse via the API. While most images are successfully hotlinked and uploaded, some remain as links or show as broken. The issue occurs specifically during API migration with skip_validations=true, and not when uploading manually. The user tried using the rake posts:rebake command, but it failed. Instead, the /posts/{num}/rebake API endpoint worked, though it was unreliable and had an 80% failure rate. Stephen noted that some images had double extensions like .jpeg.jpg, but Amethi confirmed this wasn’t the root cause. anon48433008 suggested using the ‘Rebuild HTML’ option in the admin panel, which resolved the issue. simon pointed to a related discussion that might help address the rebake command failure.
I’m migrating a load of content, about 15k worth of news stories to Discourse via the API and these topics have links to images in. The images have just been uploaded to blob storage and are fully accessible publicly.
Most topics have the images shown correctly and get hotlink downloaded and uploaded into Discourse as you’d expect. Some though either do not get past the point of showing as links in the topic, or end up getting shown as broken images for some reason.
Config is:
Virgin Discourse install just for testing the migration
S3 storage of images
I’ve had no problems just creating posts as a user and uploading issues, it seems to only occur when I migrating posts via the API, i.e. in bulk and in quick succession (am using the skip_validations=true parameter). So far I’ve only migrated a maximum of 1,000 topics before clearing down and starting again.
Any ideas for what might be causing this? Or any tips on how to diagnose? All the Hotlink Sidekiq jobs seem to schedule and run as you’d expect.
Thanks Robert. This is working for the first few I’ve tried. It’s going back to square one, i.e. rendering the hotlinked image, and then downloading/uploading it.
I’ll have to see if this can be automated, though it doesn’t get to the root cause of why they’re failing to start with.
That’s fantastic and congratulations, fortunately I learned that from other helpful people here when I’ve had similar issues and I’m happy I could pass it along to you
In the end this turned out not to be reliable, it would work for a few posts but not for all. I’ll have to have another go at trying to upload the images again. I had issues with this before with requests just hanging. I’m not sure if I tried the skip_validations parameter on those requests though.