AWS::S3::CurrentBucketNotSpecified
AWS::S3::CurrentBucketNotSpecified
No bucket name can be inferred from your current connection's address (`s3.amazonaws.com')
Has anyone seen this before? The app with Rails 3 + paperclip + s3 was working great, then I upgraded to RVM and this happened.
/config/S3.yml
common: &common
access_key_id: 123123123123123123
secret_access_key: asdasdasdasdasdasdasdasd
development:
<<: *common
bucket: xxxx_dev
test:
<<: *common
bucket: xxxx_test
production:
<<: *common
bucket: xxxx_prod
In the model:
# Paperclip for User.photo
has_attached_file :photo,
:styles => {
:thumb => "70x70>"
},
:path => "/assets/users/:id/:style/:basename.:extension",
:storage => :s3,
:s3_credentials => File.join(Rails.root, 'config', 's3.yml'),
:s3_prot开发者_Python百科ocol => 'https',
:use_timestamp => false,
:default_style => :thumb,
:default_url => '/images/profile_default_70x70.png'
Any suggestions or ideas on the issue or how to debug? Thanks
UPDATE, I'm allowing for photos to be uploaded with a url as follows:
before_validation :download_remote_image, :if => :photo_url_provided?
# Used to handle paperclip via an image URL
def photo_url_provided?
!self.photo_url.blank?
end
# Used to handle paperclip via an image URL
def download_remote_image
self.photo = do_download_remote_image
end
# Used to handle paperclip via an image URL
def do_download_remote_image
io = open(URI.parse(photo_url))
def io.original_filename; base_uri.path.split('/').last; end
io.original_filename.blank? ? nil : io
rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...)
end
add
:s3_bucket => "xyz"
to your paperclip attributes.
I'd recommend using nifty:configuration for configuration data in different environments:
I have :bucket => 'bucket_name'
in my has_attached_file configuration hash.
精彩评论