Reputation: 547
I am working with Paperclip and AWS and can successfully get the upload to work on my local host. The problem I run into is when I upload the app to Heroku I get:
AWS::S3::Errors::SignatureDoesNotMatch (The request signature we calculated does not match the signature you provided. Ch
eck your key and signing method.)
Locations.rb
has_attached_file :photo,
:styles => { :thumb => "150x150#", :medium => "200x200#", :small => "50x50"},
:path => ":attachment/:id/:style.:extension",
:s3_domain_url => "adsimgstore.s3.amazonaws.com",
:storage => :s3,
:s3_credentials => S3_CREDENTIALS,
:bucket => 'adsimgstore',
:s3_permissions => :public_read,
:convert_options => { :all => "-auto-orient" }
s3 initialize
# initializers/s3.rb
if Rails.env == "production"
# set credentials from ENV hash
S3_CREDENTIALS = { :access_key_id => ENV['S3_KEY'], :secret_access_key => ENV['S3_SECRET'], :bucket => "adsimgstore"}
else
# get credentials from YML file
S3_CREDENTIALS = Rails.root.join("config/s3.yml")
end
I have followed the Heroku tutorial https://devcenter.heroku.com/articles/s3 and added all keys
Any suggestions?
AWS::S3::Errors::SignatureDoesNotMatch (The request signature we calculated does not match the signature you provided. Ch
eck your key and signing method.):
2012-05-01T18:01:02+00:00 app[web.1]:
2012-05-01T18:01:02+00:00 app[web.1]: app/controllers/locations_controller.rb:76:in `block in update'
2012-05-01T18:01:02+00:00 app[web.1]: app/controllers/locations_controller.rb:75:in `update'
2012-05-01T18:01:02+00:00 app[web.1]:
Upvotes: 0
Views: 1812
Reputation: 2759
if you followed the heroku tutorial your environment variables would be AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
.
run heroku config
to check your env variables.
:bucket
in CredentialsYou put the :bucket
option in the S3_CREDENTIALS
-hash in the initializers/s3.rb
file. the bucket-option doesn't belong here - you already set it in the has_attached_file
method.
Upvotes: 1