【发布时间】:2015-12-13 05:26:16
【问题描述】:
我正在尝试确定为什么在尝试使用 Paperclip 将文件上传到 S3 时出现此错误:
[AWS S3 404 0.994093 1 retries] head_object(:bucket_name=>"mybucketname",:key=>"development/images/26/original/picture") AWS::S3::Errors::NoSuchKey No Such Key
s3.yml
development:
access_key_id: "xxxxxx"
secret_access_key: "xxxxxx"
production:
access_key_id: "xxxxxx"
secret_access_key: "xxxxxx"
开发.rb
config.paperclip_defaults = {
:storage => :s3,
:bucket => 'mybucketname'
}
用户.rb
has_attached_file :image,
:storage => :s3,
:s3_credentials => "#{Rails.root.to_s}/config/s3.yml",
:s3_protocol => 'https',
:path => ":rails_env/:attachment/:id/:style/:filename",
:bucket => "mybucketname",
styles: {
medium: "300x300>",
thumb: "100x100>" }
宝石文件
gem "paperclip", "~> 4.3"
gem 'aws-sdk-v1'
我已尝试删除 path 和 s3_protocol,但出现类似错误。
我尝试将访问密钥移动到development.rb。另外,我暂时设置了bucket权限,允许大家上传。
【问题讨论】:
标签: ruby-on-rails-4 amazon-web-services amazon-s3 paperclip