Rails 4: Heroku + Paperclip + s3 not working in production

前端 未结 2 922
深忆病人
深忆病人 2021-01-16 23:52

so im following this tutorial: https://devcenter.heroku.com/articles/paperclip-s3

I manage to deploy it to Heroku and App is working in the development. The app is r

相关标签:
2条回答
  • 2021-01-17 00:00

    Add region and s3_host_name.

    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"],
          s3_region: ENV["S3_REGION"],
          s3_host_name: ENV["S3_HOST_NAME"]
        }
    

    S3_REGION="eu-central-1" S3_HOST_NAME="s3.eu-central-1.amazonaws.com"

    Regions and endpoints: http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region

    Using gem "aws-sdk", "~> 2.0"

    0 讨论(0)
  • 2021-01-17 00:24

    For those facing the same problem, I solved this by renaming :bucket => ENV['S3_BUCKET_NAME'], to :bucket => ENV['AWS_BUCKET'],

    and downgrading gem 'aws-sdk' to gem 'aws-sdk', '~> 1.61.0'

    and it fix my problem.

    0 讨论(0)
提交回复
热议问题