我试图确定在尝试使用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"
development.rb
config.paperclip_defaults = {
:storage => :s3,
:bucket => 'mybucketname'
}
user.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>" }
的Gemfile
gem "paperclip", "~> 4.3"
gem 'aws-sdk-v1'
我已尝试删除path
和s3_protocol
,但我收到了类似的错误。
我尝试将访问密钥移动到development.rb
。此外,我已临时设置存储桶权限以允许每个人上传。