RoR Developer
RoR Developer

Reputation: 151

AWS::S3::Errors::PermanentRedirect on Heroku

I'm getting following error on heroku after uploading file through paperclip.

AWS::S3::Errors::PermanentRedirect (The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.)

This is my settings in the model

has_attached_file :profile_image,
 :styles => { :myrecipes => "260x180#"},
 :storage => :s3,
 :s3_region => 'us-west-1',
 :s3_credentials => "#{Rails.root}/config/amazon_s3.yml",
 :path => "/images/:id/:style.:extension",
 :url => ":s3_domain_url"

This is working on development and store image on S3 but while I'm trying on production (Heroku) I'm getting error.

Upvotes: 1

Views: 714

Answers (1)

Ajay Barot
Ajay Barot

Reputation: 1680

To Provide the endpoint you have to do add this into your paperclip_defaults

:s3_host_name => "s3-eu-west-1.amazonaws.com"

Or you can do like this

s3_host_name: "s3-#{ENV['AWS_REGION']}.amazonaws.com"

Ref: paperclip issue

Upvotes: 1

Related Questions