New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"uninitialized constant Paperclip::Storage::S3::AWS" s3 file upload w/ aws-sdk v2.7.7 #2388

Closed
leder11011 opened this Issue Feb 13, 2017 · 10 comments

Comments

Projects
None yet
8 participants
@leder11011

leder11011 commented Feb 13, 2017

Hi,

I have a ticket here:
stackoverflow

But cannot get a working configuration from anybody!

So I think, that I have found a bug in the libraries.

Please have a look...

BR
Gerrit

@leder11011 leder11011 changed the title from no implicit conversion of Symbol into String: s3 file upload to uninitialized constant Paperclip::Storage::S3::AWS: s3 file upload w/ aws-sdk v2.7.7 Feb 13, 2017

@leder11011 leder11011 changed the title from uninitialized constant Paperclip::Storage::S3::AWS: s3 file upload w/ aws-sdk v2.7.7 to "uninitialized constant Paperclip::Storage::S3::AWS" s3 file upload w/ aws-sdk v2.7.7 Feb 13, 2017

@avit

This comment has been minimized.

Show comment
Hide comment
@avit

avit Mar 23, 2017

Looking at the aws-sdk gem source, their module namespace is Aws:: but paperclip 4.3 is using AWS::, could that be your problem?

avit commented Mar 23, 2017

Looking at the aws-sdk gem source, their module namespace is Aws:: but paperclip 4.3 is using AWS::, could that be your problem?

@leder11011

This comment has been minimized.

Show comment
Hide comment
@leder11011

leder11011 Mar 27, 2017

I do not know! What do you suggest to do? In the docs there is this information:
NameError: uninitialized constant AWS

If you receive this error, you likely have upgraded to version 2 of the aws-sdk gem unintentionally. Version 2 uses the Aws namespace, not AWS. This allows version 1 and version 2 to be used in the same application.

AWS

leder11011 commented Mar 27, 2017

I do not know! What do you suggest to do? In the docs there is this information:
NameError: uninitialized constant AWS

If you receive this error, you likely have upgraded to version 2 of the aws-sdk gem unintentionally. Version 2 uses the Aws namespace, not AWS. This allows version 1 and version 2 to be used in the same application.

AWS

@avit

This comment has been minimized.

Show comment
Hide comment
@avit

avit Mar 28, 2017

These are compatible versions, use something like one of these groups in your Gemfile depending on your Rails version:

gem "rails", ">= 4.2"
gem "paperclip", ">= 5.0"
gem "aws-sdk", ">= 2.0"

or

gem "rails", "< 4.2"
gem "paperclip", "= 4.3.6" # (4.3.7 has deprecation warnings for pre-upgrade)
gem "aws-sdk", "< 2.0"

avit commented Mar 28, 2017

These are compatible versions, use something like one of these groups in your Gemfile depending on your Rails version:

gem "rails", ">= 4.2"
gem "paperclip", ">= 5.0"
gem "aws-sdk", ">= 2.0"

or

gem "rails", "< 4.2"
gem "paperclip", "= 4.3.6" # (4.3.7 has deprecation warnings for pre-upgrade)
gem "aws-sdk", "< 2.0"
@leder11011

This comment has been minimized.

Show comment
Hide comment
@leder11011

leder11011 Mar 28, 2017

I already use these versions:
Rails 5.0.1/paperclip 5.1.0/aws-sdk 2.7.3

And I tried downgrading, too!

To no avail...

leder11011 commented Mar 28, 2017

I already use these versions:
Rails 5.0.1/paperclip 5.1.0/aws-sdk 2.7.3

And I tried downgrading, too!

To no avail...

@ohiodn8

This comment has been minimized.

Show comment
Hide comment
@ohiodn8

ohiodn8 Nov 16, 2017

I had a similar issue a while back. I usually don't declare the gem version in my gemfile, but when I had this error, I changed:
gem 'aws-sdk' to gem 'aws-sdk', '~> 2.3'

bundle update

I deployed to production and it worked fine

ohiodn8 commented Nov 16, 2017

I had a similar issue a while back. I usually don't declare the gem version in my gemfile, but when I had this error, I changed:
gem 'aws-sdk' to gem 'aws-sdk', '~> 2.3'

bundle update

I deployed to production and it worked fine

@rveronese

This comment has been minimized.

Show comment
Hide comment
@rveronese

rveronese Nov 16, 2017

Had a similar problem with paperclip 5.1 and aws-sdk 2.5.1. Downgrading to 2.3 worked also for me

rveronese commented Nov 16, 2017

Had a similar problem with paperclip 5.1 and aws-sdk 2.5.1. Downgrading to 2.3 worked also for me

@abepetrillo

This comment has been minimized.

Show comment
Hide comment
@abepetrillo

abepetrillo Feb 7, 2018

For others that come here: the downgrade of aws-sdk to 2.3 did not work for me, and I'm on a legacy rails 3 app, so upgrading to papertrail >5 is also not feasible at the moment.

abepetrillo commented Feb 7, 2018

For others that come here: the downgrade of aws-sdk to 2.3 did not work for me, and I'm on a legacy rails 3 app, so upgrading to papertrail >5 is also not feasible at the moment.

@BliZZ4RD

This comment has been minimized.

Show comment
Hide comment
@BliZZ4RD

BliZZ4RD Apr 11, 2018

@abepetrillo
solved :)
Gemfile
gem 'rails', '3.2.22' gem 'paperclip', '4.3.7' gem 'aws-sdk', '< 2.0'
minio should be started with opts
MINIO_DOMAIN=minio.example.com MINIO_ACCESS_KEY=minio_access_key MINIO_SECRET_KEY=minio_secret_key minio server --address minio.example.com:9000 /path/to/dir

paperclip initializer

Paperclip::Attachment.default_options.merge!({ storage: :s3, s3_protocol: 'http', s3_permissions: 'private', s3_region: 'us-east-1', s3_credentials: { bucket: 'public', access_key_id: 'minio_access_key', secret_access_key: 'minio_secret_key', }, s3_host_name: 'minio.example.com:9000', s3_options: { endpoint: "http://minio.example.com:9000", use_ssl: false, force_path_style: true, # for aws-sdk (required for minio) }, path: ':url' })

BliZZ4RD commented Apr 11, 2018

@abepetrillo
solved :)
Gemfile
gem 'rails', '3.2.22' gem 'paperclip', '4.3.7' gem 'aws-sdk', '< 2.0'
minio should be started with opts
MINIO_DOMAIN=minio.example.com MINIO_ACCESS_KEY=minio_access_key MINIO_SECRET_KEY=minio_secret_key minio server --address minio.example.com:9000 /path/to/dir

paperclip initializer

Paperclip::Attachment.default_options.merge!({ storage: :s3, s3_protocol: 'http', s3_permissions: 'private', s3_region: 'us-east-1', s3_credentials: { bucket: 'public', access_key_id: 'minio_access_key', secret_access_key: 'minio_secret_key', }, s3_host_name: 'minio.example.com:9000', s3_options: { endpoint: "http://minio.example.com:9000", use_ssl: false, force_path_style: true, # for aws-sdk (required for minio) }, path: ':url' })

@sidraval

This comment has been minimized.

Show comment
Hide comment
@sidraval

sidraval Apr 27, 2018

Member

Looks like there are workarounds, closing.

Member

sidraval commented Apr 27, 2018

Looks like there are workarounds, closing.

@sidraval sidraval closed this Apr 27, 2018

@maguri

This comment has been minimized.

Show comment
Hide comment
@maguri

maguri Aug 30, 2018

##################################################
#  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`.

For a walkthrough of upgrading from 4 to 5 and aws-sdk >= 2.0 you can watch
http://rubythursday.com/episodes/ruby-snack-27-upgrade-paperclip-and-aws-sdk-in-prep-for-rails-5

maguri commented Aug 30, 2018

##################################################
#  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`.

For a walkthrough of upgrading from 4 to 5 and aws-sdk >= 2.0 you can watch
http://rubythursday.com/episodes/ruby-snack-27-upgrade-paperclip-and-aws-sdk-in-prep-for-rails-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment