Paperclip+S3 在本地计算机上工作,但在 Heroku 上不起作用。它显示“AWS::S3::Errors::SignatureDoesNotMatch”
2012-04-20T21:24:37+00:00 app[web.1]: Parameters: {"utf8"=>"Γ£ô", "authenticit y_token"=>"MHt20N64y9L24Ga2y6gGj8hX06U+td17XIRdqMadcCQ=", "post"=>{"title"=>"tes t", "organisation_id"=>"1", "content"=>"weeqw", "attachments_attributes"=>{"0"=> {"pic"=>#>}}}, "commit"=>"Create Post"} 2012-04-20T21:24:41+00:00 app[web.1]: Completed 500 Internal Server Error in 344 6ms 2012-04-20T21:24:41+00:00 app[web.1]: 2012-04-20T21:24:41+00:00 app[web.1]: AWS::S3::Errors::SignatureDoesNotMatch (Th e request signature we calculated does not match the signature you provided. Che ck your key and signing method.):
这是我的 Attachment.rb 模型:
has_attached_file :pic, :styles => { :medium => "500x280>",:slide => "180x260>", :thumb => "150x100#" },
:storage => :s3,
:bucket => 'sample_bucket',
:s3_credentials => {
:access_key_id => 'ASDDSAMPLEKEYDFSDF',
:secret_access_key => 'Dfsdf887-sample-secret-key-dfdsasd',
}
此错误的原因可能是什么?
最佳答案
我有回形针 2.4.5,这是模型内部的定义:
has_attached_file :logo,
:path => "assets/:class/:attachment/:id/:style.:extension",
:storage => :s3,
:bucket => ENV['S3_BUCKET'],
:s3_permissions => 'authenticated-read',
:s3_protocol => "http",
:s3_credentials => { :access_key_id => ENV['S3_KEY'],
:secret_access_key => ENV['S3_SECRET'] },
:styles => { :index => "72x72>",
:billboard => "120x120>" }
关于ruby-on-rails - Heroku Paperclip S3 错误 => AWS::S3::Errors::SignatureDoesNotMatch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10253882/