Using carrierwave for our uploaders, we get a couple of Excon errors each week from our production app. For example:
Excon::Errors::BadRequest: Expected(200) <=> Actual(400 Bad Request) excon.error.response :body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>IncompleteBody</Code><Message>The request body terminated unexpectedly</Message>
We've started wrapping the uploading process in a retry block and it always seems to work fine after another try, but I'm wondering if there is a better solution, as this becomes unwieldy after a while. It seems to me like these errors ought to be handled at a lower level. Is there a better way to handle these issues?
Here's our production configuration:
config.storage = :fog
config.root = Dir.tmpdir
config.cache_dir = 'carrierwave'
config.fog_credentials = {
provider: 'AWS',
aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'],
aws_secret_access_key: ENV['AWS_ACCESS_KEY'],
}
config.fog_directory = ENV['AWS_S3_BUCKET']
config.fog_public = false
config.fog_authenticated_url_expiration = 7.days.to_i
config.enable_processing = true
And we're using gem versions:
fog (1.27.0)
carrierwave (0.10.0)
excon (0.43.0)
carrierwave-aws
we haven't seen this issue anymore. – Supererogate