agente_secreto
agente_secreto

Reputation: 8079

Can't get Carrierwave to work with Amazon S3

I am trying to use Amazon S3 with Carrierwave. This is the first time I use S3 so I am not sure what I am doing most of the time. I am using Carrierwave with Fog, and uploading the files (just images) through ActiveAdmin, but I get a 'broken pipe' error when I try to upload anything

This is the full trace of the error.

I set up Carrierwave with this configuration in the initializer:

CarrierWave.configure do |config|
  config.fog_credentials = {
    :provider                         => 'AWS',
    :aws_access_key_id                => 'myid',
    :aws_secret_access_key            => 'mysecretkey',
  }
  config.fog_directory = 'bucketname'
  config.s3_region = 'EU'
end

And I changed this in my uploader class:

#storage :file
storage :fog

I am using Rails 3.1

Can anyone give me a clue about what's wrong? I've been searching through open issues of Carrierwave and Fog and cant find anything.

IMPORTANT EDIT: I just tried to upload a very small image and it worked, but for some reason >100 KB are giving me the "broken pipe" error.

Upvotes: 0

Views: 1166

Answers (2)

sfkaos
sfkaos

Reputation: 205

In my case the 'Broken pipe' was being caused by a RequestTimeTooSkewed error. Here it is explained by the AWS site: http://www.bucketexplorer.com/documentation/amazon-s3--difference-between-requesttime-currenttime-too-large.html.

So because the default S3 bucket location is the us-east-1 and I'm located in the West I had to change my bucket's "Region" to Oregon or us-west and it worked!

Upvotes: 0

stfcodes
stfcodes

Reputation: 1380

The s3_region should be 'eu-west-1'.

Upvotes: 0

Related Questions