ruby on rails - Paperclip uploads on Heroku using S3 -
i'm sorry rehash old gripe i'm @ wits end , not sure go next. using paperclip on heroku , have s3 uploads configured. able things working in local development environment once it's running on heroku run error:
aws::s3::errors::permanentredirect (the bucket attempting access must addressed using specified endpoint. please send future requests endpoint.
i've googled error , read through heroku documentation , believe have set correctly. thought problems stemmed having bucket in s3-us-west-1.amazonaws.com
region, i'm not convinced anymore.
here relevant parts of heroku config:
aws_region: us-west-1 s3_bucket_name: my-super-awesomely-amazing-bucket
from config/environments/production.rb file:
config.paperclip_defaults = { :storage => :s3, :s3_credentials => { :bucket => env['s3_bucket_name'], :access_key_id => env['aws_access_key_id'], :secret_access_key => env['aws_secret_access_key'] } }
my paperclip.rb initialize file:
if rails.env.production? 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-us-west-1.amazonaws.com' end
and paperclip config relevant model:
has_attached_file :document, :styles => { }, :default_url => "/image_styles/:style/missing.png"
so...what doing wrong here? @ point i'm sure i've missed obvious i'm stumped on go here. feel i've assiduously configured , yet permanentredirect
error keeps coming up.
bucket
this might not direct solution, we've found have include bucket
option outside of s3_credentials
block:
#config/environments/production.rb config.paperclip_defaults = { storage: :s3, s3_host_name: 's3-eu-west-1.amazonaws.com', s3_credentials: { access_key_id: env['aws_access_key_id'], secret_access_key: env['aws_secret_access_key'] }, bucket: env['s3_bucket_name'] }
this working 100% on heroku, whether wil work (as bucket in different region) different matter
if need more help, ask comment , i'll gladly give ideas
Comments
Post a Comment