In my Rails app I\'m letting users upload an image when they create a \"release\", and it should upload directly to S3. I\'m getting the following error in both development and
I think that's because :bucket
should be an option passed to Paperclip not to S3.
Fixed config
config.paperclip_defaults = {
:storage => :s3,
:s3_protocol => 'http',
:bucket => ENV['AWS_BUCKET'],
:s3_credentials => {
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
}
And Paperclip::Storage::S3 doc seems to confirm that, even being so poorly written/formatted.
EDIT:
In one of my projects I use Paperclip with Fog gem and this works well
Paperclip::Attachment.default_options.merge!(
:storage => :fog,
:fog_credentials => {
:provider => 'AWS',
:aws_access_key_id => ENV['S3_ACCESS_KEY_ID'],
:aws_secret_access_key => ENV['S3_SECRET_ACCESS_KEY'],
:region => 'eu-west-1' # in case you need it
},
:fog_directory => ENV['S3_BUCKET'], # only one of those is needed but I don't remember which
:bucket => ENV['S3_BUCKET']
)