UPDATED CONTENT
My Setup is now as follows:
#Carrierwave Initializer
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => ENV['S3_KEY'],
:aws_secret_access_key => ENV['S3_SECRET'],
}
config.fog_directory = ENV['S3_BUCKET_NAME']
config.fog_public = false # optional, defaults to true
config.fog_attributes = {'Cache-Control'=>'max-age=315576000'}
end
#Uploader
class ProteinUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
storage :fog
def store_dir
"images/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
end
#Heroku Config Variables
S3_BUCKET_NAME = top5protein
S3_KEY = 'xxx'
S3_SECRET = 'xxx'
#Gemfile
...
gem "fog", "~> 1.14.0"
gem "excon", "~> 0.25.3"
gem 'carrierwave'
gem 'activeadmin'
...
And the error I am still getting is:
Excon::Errors::Forbidden (Expected(200) <=> Actual(403 Forbidden)
2013-07-28T11:51:13.251291+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/excon-0.25.3/lib/excon/connection.rb:260:in `rescue in request'
2013-07-28T11:51:13.251455+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/excon-0.25.3/lib/excon/connection.rb:220:in `request'
2013-07-28T11:51:13.251056+00:00 app[web.1]: FYyKoH99bOV97aK1TQI9dEhIBycFUg2TyP2fYuzY1/Ke+TXevyjKlUA</HostId><SignatureProvided>ZuHHwrD3Qdo9IHNhE14eKiB0OgY=</SignatureProvided><StringToSign>PUT\n\nimage/png\nSun, 28 Jul 2013 11:51:12 +0000\nx-amz-acl:private\n/top5protein/images/general/image/2/Protein1.png</StringToSign><AWSAccessKeyId>AKIAJ5GKDLKK3CPHNTGA</AWSAccessKeyId></Error>", @headers={"x-amz-request-id"=>"04AD4FA1DDE488CE", "x-amz-id-2"=>"SkpxPPpk0FYyKoH99bOV97aK1TQI9dEhIBycFUg2TyP2fYuzY1/Ke+TXevyjKlUA", "Content-Type"=>"application/xml", "Transfer-Encoding"=>"chunked", "Date"=>"Sun, 28 Jul 2013 11:51:12 GMT", "Connection"=>"close", "Server"=>"AmazonS3"}, @status=403, @remote_ip="207.171.163.195">):
and
HNTGA</AWSAccessKeyId></Error>", :headers=>{"x-amz-request-id"=>"04AD4FA1DDE488CE", "x-amz-id-2"=>"SkpxPPpk0FYyKoH99bOV97aK1TQI9dEhIBycFUg2TyP2fYuzY1/Ke+TXevyjKlUA", "Content-Type"=>"application/xml", "Transfer-Encoding"=>"chunked", "Date"=>"Sun, 28 Jul 2013 11:51:12 GMT", "Connection"=>"close", "Server"=>"AmazonS3"}, :status=>403, :remote_ip=>"207.171.163.195"}, @body="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><StringToSignBytes>50 55 54 0a 0a 69 6d 61 67 65 2f 70 6e 67 0a 53 75 6e 2c 20 32 38 20 4a 75 6c 20 32 30 31 33 20 31 31 3a 35 31 3a 31 32 20 2b 30 30 30 30 0a 78 2d 61 6d 7a 2d 61 63 6c 3a 70 72 69 76 61 74 65 0a 2f 74 6f 70 35 70 72 6f 74 65 69 6e 2f 69 6d 61 67 65 73 2f 67 65 6e 65 72 61 6c 2f 69 6d 61 67 65 2f 32 2f 50 72 6f 74 65 69 6e 31 2e 70 6e 67</StringToSignBytes><RequestId>04AD4FA1DDE488CE</RequestId><HostId>SkpxPPpk0
If anyone has any further advice that might help then that would be great!
In your case (as noted in the last comment) and in mine, the reason for this error was an incorrect secret key.
I thought I'd leave this here for future people getting this error so they could check the most probable source of the problem first.