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

Does Paperclip 4.3.1 support aws-sdk-v2? #2021

Closed
BigMcLargeHuge opened this Issue Oct 10, 2015 · 16 comments

Comments

Projects
None yet
7 participants
@BigMcLargeHuge

BigMcLargeHuge commented Oct 10, 2015

Judging from this thread and the commits going into version 4.3.1, my understanding is that aws-sdk-v2 is officially supported by the latest release of paperclip. But, when I attempt to upload using gem 'paperclip', '~> 4.3.1' with gem 'aws-sdk', '~> 2.1.28' I get the old error

uninitialized constant Paperclip::Storage::S3::AWS

Is there anything special I need to do to apply paperclip to v2 with this new support?

@hughevans

This comment has been minimized.

Show comment
Hide comment
@hughevans

hughevans Oct 11, 2015

Try this rev 523bd46c768226893f23889079a7aa9c73b57d68

hughevans commented Oct 11, 2015

Try this rev 523bd46c768226893f23889079a7aa9c73b57d68

@BigMcLargeHuge

This comment has been minimized.

Show comment
Hide comment
@BigMcLargeHuge

BigMcLargeHuge Oct 12, 2015

Well played @hughevans! I see that this commit states "No need to specify aws-sdk version." Was there a way to specify it in the 4.3.1 release? If so, I didn't see any notes on it.

Just to make it easier on others, here are a couple other tricky parts I found when applying this modification:

You can specify this particular revision of paperclip to bundler with the following line:

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

More information on this sort of thing can be found here.

You will need to specify the REGION of your in your paperclip defaults. This can be done by dropping a :s3_region=> 'us-west-2' (or whatever your region is) into your paperclip_defaults. Simply specifying the endpoint or host will not be enough. You can look yours up here.

Also slightly confusing is the error message if the above isn't done properly:

missing region; use :region option or export region name to ENV['AWS_REGION']

  1. I couldn't get the recommended environment variable to work.
  2. The :region option is somewhat misleading as it needs to be written :s3_region

Anyway, thanks again hugh!

BigMcLargeHuge commented Oct 12, 2015

Well played @hughevans! I see that this commit states "No need to specify aws-sdk version." Was there a way to specify it in the 4.3.1 release? If so, I didn't see any notes on it.

Just to make it easier on others, here are a couple other tricky parts I found when applying this modification:

You can specify this particular revision of paperclip to bundler with the following line:

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

More information on this sort of thing can be found here.

You will need to specify the REGION of your in your paperclip defaults. This can be done by dropping a :s3_region=> 'us-west-2' (or whatever your region is) into your paperclip_defaults. Simply specifying the endpoint or host will not be enough. You can look yours up here.

Also slightly confusing is the error message if the above isn't done properly:

missing region; use :region option or export region name to ENV['AWS_REGION']

  1. I couldn't get the recommended environment variable to work.
  2. The :region option is somewhat misleading as it needs to be written :s3_region

Anyway, thanks again hugh!

@son1112

This comment has been minimized.

Show comment
Hide comment
@son1112

son1112 Oct 12, 2015

@BigMcLargeHuge, thanks for providing the gem line for that revision. I still get the slightly confusing error message you mentioned, though I have used :s3_region instead of :region. Not sure yet what else I have misconfigured. Any ideas?

son1112 commented Oct 12, 2015

@BigMcLargeHuge, thanks for providing the gem line for that revision. I still get the slightly confusing error message you mentioned, though I have used :s3_region instead of :region. Not sure yet what else I have misconfigured. Any ideas?

@son1112

This comment has been minimized.

Show comment
Hide comment
@son1112

son1112 Oct 12, 2015

Nevermind. I foolishly mis-configured my environment variables... derp!

son1112 commented Oct 12, 2015

Nevermind. I foolishly mis-configured my environment variables... derp!

@BigMcLargeHuge

This comment has been minimized.

Show comment
Hide comment
@BigMcLargeHuge

BigMcLargeHuge Oct 13, 2015

@son1112 Heh, it happens, glad everything's working!

BigMcLargeHuge commented Oct 13, 2015

@son1112 Heh, it happens, glad everything's working!

@tute tute closed this Oct 14, 2015

@edgarsilva

This comment has been minimized.

Show comment
Hide comment
@edgarsilva

edgarsilva Oct 15, 2015

@son1112 @BigMcLargeHuge Hey guys how does your configuration (paperclip_defaults) look like? I'm still having this issue running aws-sdk (2.1.29) and paperclip (4.3.1). If I switch to aws < 2 it works.

edgarsilva commented Oct 15, 2015

@son1112 @BigMcLargeHuge Hey guys how does your configuration (paperclip_defaults) look like? I'm still having this issue running aws-sdk (2.1.29) and paperclip (4.3.1). If I switch to aws < 2 it works.

@BigMcLargeHuge

This comment has been minimized.

Show comment
Hide comment
@BigMcLargeHuge

BigMcLargeHuge Oct 15, 2015

Hi @edgarsilva You say that you're using paperclip 4.3.1? The findings of this thread are that 4.3.1 still has issues and that you should use the revision suggested above and NOT 4.3.1. Apply the above revision to your Gemfile and see if that works.

BigMcLargeHuge commented Oct 15, 2015

Hi @edgarsilva You say that you're using paperclip 4.3.1? The findings of this thread are that 4.3.1 still has issues and that you should use the revision suggested above and NOT 4.3.1. Apply the above revision to your Gemfile and see if that works.

@tute

This comment has been minimized.

Show comment
Hide comment
@tute

tute Oct 15, 2015

Contributor

We will release 4.3.2 including 523bd46 in around a week. cc @jyurek in case you get to it before I do!


UPDATE: we could not, use AWS v1 insted #2021 (comment)

Contributor

tute commented Oct 15, 2015

We will release 4.3.2 including 523bd46 in around a week. cc @jyurek in case you get to it before I do!


UPDATE: we could not, use AWS v1 insted #2021 (comment)

@edgarsilva

This comment has been minimized.

Show comment
Hide comment
@edgarsilva

edgarsilva Oct 15, 2015

Thanks @BigMcLargeHuge, @tute figured out that one yesterday after some experimenting, looking into the code and using @BigMcLargeHuge suggestion. Got confused because of the dates of the gem and thought it was included. Great work with the paperclip gem! hope to be able to contribute back to the project soon.

edgarsilva commented Oct 15, 2015

Thanks @BigMcLargeHuge, @tute figured out that one yesterday after some experimenting, looking into the code and using @BigMcLargeHuge suggestion. Got confused because of the dates of the gem and thought it was included. Great work with the paperclip gem! hope to be able to contribute back to the project soon.

@tute

This comment has been minimized.

Show comment
Hide comment
@tute

tute Oct 21, 2015

Contributor

We will release 4.3.2 including 523bd46 in around a week.

We can't do this because there are backwards incompatible changes. Will update the README instead with context from this issue. Thanks!

Contributor

tute commented Oct 21, 2015

We will release 4.3.2 including 523bd46 in around a week.

We can't do this because there are backwards incompatible changes. Will update the README instead with context from this issue. Thanks!

tute added a commit that referenced this issue Oct 21, 2015

Clarify AWS-SDK versions in README
Add context from:
#2021

[ci skip]
@cpjolicoeur

This comment has been minimized.

Show comment
Hide comment
@cpjolicoeur

cpjolicoeur Oct 27, 2015

Wait, the 4.3.2 patch release contains "backwards incompatible changes"???

On a patch release?

cpjolicoeur commented Oct 27, 2015

Wait, the 4.3.2 patch release contains "backwards incompatible changes"???

On a patch release?

@tute

This comment has been minimized.

Show comment
Hide comment
@tute

tute Oct 27, 2015

Contributor

We can't release a patch version. To 4.3.1, 5.0.0 will follow (unless there are single commits that should be backported).

Contributor

tute commented Oct 27, 2015

We can't release a patch version. To 4.3.1, 5.0.0 will follow (unless there are single commits that should be backported).

@augnustin

This comment has been minimized.

Show comment
Hide comment
@augnustin

augnustin Dec 1, 2015

So I updated my gems to use:

    paperclip (4.3.2)
      activemodel (>= 3.2.0)
      activesupport (>= 3.2.0)
      cocaine (~> 0.5.5)
      mime-types
      mimemagic (= 0.3.0)
    aws-sdk (2.2.0)
      aws-sdk-resources (= 2.2.0)
    aws-sdk-core (2.2.0)
      jmespath (~> 1.0)
    aws-sdk-resources (2.2.0)
      aws-sdk-core (= 2.2.0)

And my config:

  config.paperclip_defaults = {
    storage: :s3,
    s3_region: 'eu-west-1',
    s3_credentials: {
      bucket: ENV['AWS_BUCKET_AVATARS'],
      access_key_id: ENV['AWS_ACCESS_KEY_ID'],
      secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
    }
  }

But I still get: uninitialized constant Paperclip::Storage::S3::AWS

What am I doing wrong?

augnustin commented Dec 1, 2015

So I updated my gems to use:

    paperclip (4.3.2)
      activemodel (>= 3.2.0)
      activesupport (>= 3.2.0)
      cocaine (~> 0.5.5)
      mime-types
      mimemagic (= 0.3.0)
    aws-sdk (2.2.0)
      aws-sdk-resources (= 2.2.0)
    aws-sdk-core (2.2.0)
      jmespath (~> 1.0)
    aws-sdk-resources (2.2.0)
      aws-sdk-core (= 2.2.0)

And my config:

  config.paperclip_defaults = {
    storage: :s3,
    s3_region: 'eu-west-1',
    s3_credentials: {
      bucket: ENV['AWS_BUCKET_AVATARS'],
      access_key_id: ENV['AWS_ACCESS_KEY_ID'],
      secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
    }
  }

But I still get: uninitialized constant Paperclip::Storage::S3::AWS

What am I doing wrong?

@tute

This comment has been minimized.

Show comment
Hide comment
@tute

tute Dec 1, 2015

Contributor

Paperclip 4 works with AWS v1 only.

Contributor

tute commented Dec 1, 2015

Paperclip 4 works with AWS v1 only.

@augnustin

This comment has been minimized.

Show comment
Hide comment
@augnustin

augnustin Dec 1, 2015

Really? That's not what's mentionned there: 523bd46

I understood from the whole thread that the 4.3.2 does include the fix on AWS v2, doesn't it?

augnustin commented Dec 1, 2015

Really? That's not what's mentionned there: 523bd46

I understood from the whole thread that the 4.3.2 does include the fix on AWS v2, doesn't it?

@tute

This comment has been minimized.

Show comment
Hide comment
@tute

tute Dec 1, 2015

Contributor

Yep, that's in master. We can't release these patches because of #2021 (comment) (they are backwards incompatible).

Contributor

tute commented Dec 1, 2015

Yep, that's in master. We can't release these patches because of #2021 (comment) (they are backwards incompatible).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment