I am trying to use paperclip and amazon s3. My bucket is in the EU (Ireland) And I got this error:
AWS::S3::Errors::PermanentRedirect in MyControllerController
The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
It is very annoying, I tried to fix it, but I think that I will die, I continue to try.
So this is my code:
s3.yml
access_key_id: *****
secret_access_key: ****
bucket: mybucketname
AWS_CALLING_FORMAT: s3-eu-west-1-amazonaws.com #not sure for this one
I put the calling format 10 minutes ago for the last test, but nothing changed
config/initializers/paperclip.rb
Paperclip.options[:command_path] = "/usr/local/bin/"
Paperclip::Attachment.default_options[:url] = ':s3_domain_url'
Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename'
Paperclip::Attachment.default_options[:s3_host_name] = 's3-eu-west-1-amazonaws.com'
and so, my model:
has_attached_file :attachment,
:storage => :s3,
:s3_credentials => "#{Rails.root}/config/s3.yml",
:path => "pictures/:id/:style.:extension",
:bucket => 'mybucketname'
and finally
Paperclip.interpolates(:s3_eu_url) { |assets, style|
"#{assets.s3_protocol}://s3-eu-west-1.amazonaws.com/#{assets.recipesappdev} /#{assets.path(style).gsub(%r{^/}, "")}"
}
So, if I forgot to put the file here, feel free to tell me. Does anyone have an idea?
thank
EDIT:
Now I have this error:
getaddrinfo: nodename nor servname provided, or not known
... I really don't know