basic S3 example does not appear to work, credentials not set in the uploader

164 views
Skip to first unread message

FredO

unread,
May 18, 2012, 5:43:51 PM5/18/12
to carrierwave
I have been experimenting with the basic S3 example in the Rails
console, and it doesn't seem to set the credentials in the uploader .
(BTW I am using mongoid, not that it should make a difference in this
example.)

I generated a PhotoUploader class as described in the instructions,
(setting storage to :fog), and put the following in application.rb:

CarrierWave.configure do |config|
config.fog_credentials = {
provider: 'AWS',
aws_access_key_id: StorageMgr.public_key("xxxxxx"),
aws_secret_access_key: StorageMgr.private_key("yyyyyy")
}
config.fog_directory = "my_directory"
end

If I create an instance of the PhotoUploader and examine the
creditials:

uploader.fog_credentials
=>
{:provider=>"AWS", :aws_access_key_id=>nil, :aws_secret_access_key=>nil}

Both the :aws_access_key_id and :aws_secret_access_keys are nil.

If I try and store a file, I get "Missing required arguments:
aws_access_key_id, aws_secret_access_key"

file = File.open "/tmp/my_picture.jpg"
s = uploader.store! file
ArgumentError: Missing required arguments: aws_access_key_id,
aws_secret_access_key

What am I missing here?
Reply all
Reply to author
Forward
0 new messages