ruby-on-rails - Heroku Paperclip S3 错误 => AWS::S3::Errors::SignatureDoesNotMatch

标签 ruby-on-rails heroku amazon-s3 paperclip

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/

相关文章:

java - Amazon Web 服务 EMR 文件系统

html - 无法覆盖 Rails 中的 Bootstrap .help-block margin-top

sql - 我的 Rails 查询开始变得复杂,我应该切换到原始 SQL 查询吗?你做什么工作?

ssl - 无法将 Heroku 连接到自定义 Google 域

node.js - Heroku 配置 :push not adding environment variables

django - '可疑操作: Attempted access to "" denied' while loading static files

ruby-on-rails - 如何将 Searchkick gem 与acts_as_taggable gem 一起使用?

ruby-on-rails - heroku部署上的迁移错误

spring-boot - 将 Spring Boot 应用程序推送到 Heroku 时出错

node.js - Promise 或与 Node js 异步