uninitialized constant AWS::S3::NoSuchBucket

空扰寡人 提交于 2019-12-11 13:08:49

问题


I am using Rails 3 with the following code...

config.gem "aws-s3", :version => ">= 0.6.2", :lib => "aws/s3"
config.gem 'right_aws', :version => '2.0.0'

model.rb

has_attached_file :video, 
                      :storage => :s3,
                      :s3_credentials => "#{::Rails.root.to_s}/config/s3.yml",
                      :path => ":attachment/:id/:style/:basename.:extension"

                    # Paperclip Validations
                    validates_attachment_presence :video
                    validates_attachment_content_type :video, :content_type => ['application/x-shockwave-flash', 'application/x-shockwave-flash', 'application/flv', 'video/x-flv']

s3.yml

development:
  bucket_name: tekbookvideo
  access_key_id: xxxx
  secret_access_key: yyyy
production:
  bucket_name: tekbookvideo
  access_key_id: xxxx
  secret_access_key: yyyy

And am getting the uninitialized constant AWS::S3::NoSuchBucket error...

I do not know what to do anymore...


回答1:


I encountered this problem and experienced a very large headache over it. My eventual solution was to log in to amazon and create a new bucket. Then I set the name of the bucket in the model as a parameter like so...

has_attached_file :video,
  :storage => :s3,
  :bucket => 'bucketname',
  ...



回答2:


It appears to be a bug in the current version of Paperclip. See:

https://github.com/thoughtbot/paperclip/issues/issue/363




回答3:


I heard people had this issue because there were using european bucket which is not support by aws3




回答4:


Posted this on a similar thread, but here it is again:

I was just having this very same issue. Then I read something about Paperclip creating buckets where they don't exist. I appended a 1 to the end of my already created bucket name, and all of a sudden it worked. I think it might have something to do with the other end. Try setting the bucket name to something other than the one you've probably already created... Highly counter intuitive...




回答5:


I created a european bucket first that didn't work. Recreating the bucket again in the standard US location did the trick for me. (Thx Boris).



来源:https://stackoverflow.com/questions/4489542/uninitialized-constant-awss3nosuchbucket

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!