R2 Outage/Errors?

We have 1k+ .svg in r2 and have been serving them up inside out product for customers for over a month without any issues. On Friday 5/17 close to 100+ are failing to be served up. We are now getting a the following error on these images.

Content Encoding Error
An error occurred during a connection to “domain”

None of the files have changed in over a month, and I can download the files and they are all clean and work fine locally. Just having them served out of R2 since Friday is failing. Any ideas?

1 Like

This is most likely due to the file being uncompressed, but your metadata saying it is.

There was some change last week where it looks like Cloudflare will no longer compensate for that mismatch.

You’ll have to edit the metadata to remove that mismatch, or re-upload a compressed file with matching metadata.

2 Likes

For future reference for anyone that runs into this problem here is what we found and how we fixed it. There are a couple of problems in the mix.

  1. S3 based tools like Cyberduck etc. mess with SVG meta data when you upload to R2 which tweaked all the SVGs we uploaded to have flag them as mismatch at which point R2 wouldn’t server them out.
  2. When dealing with so many files transporting them from server/client etc many tools want to zip them in transport. So when we had made all the correction to the svgs and were moving them from designer to uploading them they got touched by zip transport which then broke them again.
    3.That then lent it self to another issue, instead of writing a upload script to post them to R2 we tried the R2 UI uploader. Finding out it has a limit of 100 files at a time. Also finding out that if you try to do a 100 at a time some times some of the files will fail on upload and you have to track them to make sure you repush them. Long story short after way to many hours of messing with SVG and uploading we got it sorted.

How we fixed the files in bulk for the mismatch errors, those that want to not try and find a solution here is one way, and the way we did it.

#!/bin/bash

Check for empty files

for file in *.svg; do
if [ ! -s “$file” ]; then
echo “Empty file: $file”
fi
done

Process each SVG file individually

for file in *.svg; do
svgo --multipass “$file”
if [ $? -ne 0 ]; then
echo “Error processing file: $file”
fi
done

Save that as svgo_run.sh or whatever file name, then chmod +x <fileName> then ./<filename>

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.