I'm trying to use the carrierwave and carrierwave-azure gems to save uploaded files in my app to the azure storage blob. The documentation for the carrierwave-azure gem seems a bit lite on github, but I believe have followed all the setup directions correctly (https://github.com/unosk/carrierwave-azure). However it still doesn't work.
When I attempt to upload a file I get the following error:
Azure::Core::Http::HTTPError in DownstreamsController#create OutOfRangeInput (400): One of the request inputs is out of range.
My carrierwave.rb looks like this:
CarrierWave.configure do |config|
config.azure_credentials = {
storage_account_name: 'myaccountname',
storage_access_key: 'reallylongstringwithcapandlowercaselettersand+signs=='
}
config.azure_container = 'http://myapp.blob.core.windows.net/shipmentdocs'
end
My uploader:
include CarrierWave::RMagick
storage :azure
def store_dir
"http://myapp.blob.core.windows.net/shipmentdocs/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
version :thumb do
process :convert => 'jpg'
process :resize_to_limit => [100, 100]
end
def extension_white_list
%w(jpg jpeg gif png pdf doc)
end
I've included both gems in my gem file. If I switch the storage from :azure to :file the upload works however it stores in the app directory, I want to store the file as a blob in Azure.
Not sure that it matters, but I am trying to do this from my local dev environment via localhost. Any help would be greatly appreciated.
UPDATE: Here are the request parameters being submitted:
> {"utf8"=>"✓", > "authenticity_token"=>"X/Q1ADOLgdaLJVsdrerdHdK9S/kJtSfjkjiutEuYsTYRY=", > "downstream"=>{"bols_attributes"=>{"0"=>{"file_name"=>#<ActionDispatch::Http::UploadedFile:0x00000107c58340 > @original_filename="test-azure-storage-bol-file.png", > @content_type="image/png", @headers="Content-Disposition: form-data; > name=\"downstream[bols_attributes][0][file_name]\"; > filename=\"test-azure-storage-bol-file.png\"\r\nContent-Type: > image/png\r\n", > @tempfile=#<Tempfile:/var/folders/dc/y286vygx1jq5wjw3f6b6bcww0000gn/T/RackMultipart20140514-8268-ngdw0m>>}}, > "sales_order"=>"RTEWW423", "to_company_id"=>"2", > "ship_date"=>"2014-05-14", "ship_total_pallets"=>"1", > "downstreamDetails_attributes"=>{"0"=>{"tb_product_type_id"=>"17", > "ship_total_net_weight"=>"3000", "ship_total_gross_weight"=>"3000", > "_destroy"=>"false"}}}, "commit"=>"Submit"}