NameError (uninitialized constant Paperclip::Storage::S3::AWS):

廉价感情. 提交于 2019-11-27 12:15:47
TopaZ

Modify your Gemfile's aws-sdk to install a version prior to 2.0:

gem 'aws-sdk', '< 2.0'

This issue was introduced with new version of aws-sdk (2.0+). You can read more here: http://ruby.awsblog.com/post/TxFKSK2QJE6RPZ/Upcoming-Stable-Release-of-AWS-SDK-for-Ruby-Version-2

There is official solution Use paperclip from this branch: it works with aws-sdk versions above 2

gem 'paperclip', :git=> 'https://github.com/thoughtbot/paperclip', :ref => '523bd46c768226893f23889079a7aa9c73b57d68'

just add :s3_region parameter to your paperclip s3 config

works for me

RichiRich

I got it to work by navigating to my gem folder and changing the Gems to:

  • gem ‘paperclip’
  • gem ‘aws-sdk’

The version declarations can be dropped.

To avoid getting a gem.lock error, run bundle update instead of bundle install, otherwise only the gems will be updated.

Now, the heroku logs -t command can be used to monitor the heroku server to image uploads.

I orginally received a new error, Access Denied Error for AWS server.

To fix this I found the Active Access Key ID with the latest date on the Amazon websiteand used heroku commands to input the latest Access key ID and Secret access key.

This enabled me to view my image on heroku.

I had made so many Access key ID and Secret access keys trying to fix the problem, but found the Gems to be the real problem.

Tip: Save all your Access Key info to OneNote, Notepad, etc. This way you can return and check them.

equivalent8

Paperclip use to use AWS-SDK v1 in versions 4.3 and bellow. They are trying to include the AWS-SDK v2

official upgrade document https://github.com/thoughtbot/paperclip/blob/master/UPGRADING

##################################################
#  NOTE FOR UPGRADING FROM 4.3.0 OR EARLIER       #
##################################################

Paperclip is now compatible with aws-sdk >= 2.0.0.

If you are using S3 storage, aws-sdk >= 2.0.0 requires you to make a few small
changes:

* You must set the `s3_region`
* If you are explicitly setting permissions anywhere, such as in an initializer,
  note that the format of the permissions changed from using an underscore to
  using a hyphen. For example, `:public_read` needs to be changed to
  `public-read`.

due to some backwards incomparability (read this https://github.com/thoughtbot/paperclip/issues/2021) this is merged but officially not released yet, but should be released in Paperclip v 5.0.0

So like Vitali Mogilevsky mentioned, you have to use this for now:

# Gemfile
# ...
gem 'paperclip', :git=> 'https://github.com/thoughtbot/paperclip', :ref => '523bd46c768226893f23889079a7aa9c73b57d68'

When Paperclip 5.0 is released, AWS-SDK v2 should be included

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!