Skip to content
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

Comfy needs downgraded aws-sdk gem to work #666

Closed
Momus opened this issue Jul 11, 2015 · 7 comments
Closed

Comfy needs downgraded aws-sdk gem to work #666

Momus opened this issue Jul 11, 2015 · 7 comments

Comments

@Momus
Copy link

Momus commented Jul 11, 2015

This is a result of an open issue with Paperclip, that should be fixed any day now but it gave me much trouble, so I thought I would at least document it here.

Symptoms:

File uploads to AWS S3 don't work. You observe a progress bar, but soon it turns red with the message: NameError in Comfy::Admin::Cms::FilesController#create
The server spits out the following:

   Comfy::Cms::File Exists   (0.2ms)  begin transaction
Command :: PATH=/usr/local/bin:$PATH; file -b --mime '/tmp/8b43e47c717a305e664b5c2ee6488f7a20150710-4457-11dz6dk.jpg'
  Comfy::Cms::File Exists (0.2ms)  SELECT  1 AS one FROM "comfy_cms_files" WHERE ("comfy_cms_files"."file_file_name" = 'TestFile.jpg' AND "comfy_cms_files"."site_id" = 1 AND "comfy_cms_files"."block_id" IS NULL) LIMIT 1

(0.1ms)  SELECT MAX("comfy_cms_files"."position") FROM "comfy_cms_files"
  SQL (0.5ms)  INSERT INTO "comfy_cms_files" ("file_file_name", "file_content_type", "file_file_size", "site_id", "label", "created_at", "updated_at", "position") VALUES (?, ?, ?, ?, ?, ?, ?, ?)  [["file_file_name", "TestFile.jpg"], ["file_content_type", "image/jpeg"], ["file_file_size", 32758], ["site_id", 1], ["label", "197810 Test File"], ["created_at", "2015-07-11 00:45:49.049994"], ["updated_at", "2015-07-11 00:45:49.049994"], ["position", 2]]
[paperclip] saving uploaded_files/TestFile.jpg
   (0.2ms)  rollback transaction
Completed 500 Internal Server Error in 107ms (ActiveRecord: 1.3ms)

NameError (uninitialized constant Paperclip::Storage::S3::AWS):
paperclip (4.3.0) lib/paperclip/storage/s3.rb:360:in `rescue in block in flush_writes'
  paperclip (4.3.0) lib/paperclip/storage/s3.rb:373:in `block in flush_writes'
  paperclip (4.3.0) lib/paperclip/storage/s3.rb:330:in `each'

Fix:

In your Gemfile:
gem "aws-sdk" , '<2.0'

@wintondeshong
Copy link

+1 to fix

1 similar comment
@keesbriggs
Copy link

+1 to fix

@Momus
Copy link
Author

Momus commented Jul 27, 2015

It's up to Paperclip: there is a pull request with the fix: thoughtbot/paperclip#1730
AWS v2 support seems to be their most requested feature, so I'm sure it's high in their queue. For now, using the v1 branch of aws-sdk (1.64.0) worked for me.

@lyneux
Copy link

lyneux commented Aug 13, 2015

+1 to fix

@Momus
Copy link
Author

Momus commented Sep 11, 2015

Thoughtbot has released version 4.3 of Paperclip 18 hours ago. Haven't tested it yet, will close issue if it works.
thoughtbot/paperclip@9cb8858

@fabn
Copy link

fabn commented Nov 5, 2015

Version 4.3 of paperclip does not include aws-sdk v2 support. I'm testing current master and it seems to work.

@espen
Copy link
Contributor

espen commented Aug 22, 2016

Paperclip now supports aws-sdk 2x. https://github.com/thoughtbot/paperclip/blob/master/UPGRADING

I was getting an error in Comfy (listing files in admin view) recently after upgrading some gems, I didn't research why but I'm assuming it was due to Paperclip being upgraded from 4.3.7 to 5.0.0. Upgrading to aws-sdk 2 latest and setting s3_region in the comfy paperclip initialiser fixed it.

So I think this issue should be closed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants