Paperclip + S3在本地机器上工作但不适用于Heroku。它说“AWS :: S3 :: Errors :: SignatureDoesNotMatch”
2012-04-20T21:24:37 + 00:00 app [web.1]:参数:{“utf8”=>“Γ£ô”, “authenticit y_token”=>“MHt20N64y9L24Ga2y6gGj8hX06U + td17XIRdqMadcCQ =”, “post”=> {“title”=>“tes t”,“organisation_id”=>“1”,“content”=>“weeqw”, “attachments_attributes”=> { “0”=> { “PIC”=>#>}}}, “commit”=>“创建帖子”} 2012-04-20T21:24:41 + 00:00 app [web.1]: 在344 6ms内完成500内部服务器错误 2012-04-20T21:24:41 + 00:00 app [web.1]:2012-04-20T21:24:41 + 00:00 app [web.1]: AWS :: S3 :: Errors :: SignatureDoesNotMatch (请求 我们计算的签名与您提供的签名不符。车 ck你的密钥和签名方法。):
这是我的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',
}
出现此错误的原因可能是什么?
答案 0 :(得分:1)
我是回形针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>" }
答案 1 :(得分:1)
我遇到了与Heroku类似的问题并发现了https://rubygems.org/gems/paperclip-aws。
这解决了我的问题。