# Error configuring s3 with attachment\_fu

**URL:** <https://www.ruby-forum.com/t/error-configuring-s3-with-attachment-fu/144046>\
**Category:** Rails\
**Created:** [July 24, 2008, 10:06pm UTC](https://www.ruby-forum.com/t/error-configuring-s3-with-attachment-fu/144046 "2008-07-24T22:06:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![seanhussey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a88e57/32.png) [@seanhussey](https://www.ruby-forum.com/u/seanhussey)\
**Post date:** [July 24, 2008, 10:06pm UTC](https://www.ruby-forum.com/t/error-configuring-s3-with-attachment-fu/144046/1 "2008-07-24T22:06:00Z")

</div>

Hi everyone,

I’m configuring attachment\_fu to use s3, but I’m getting an error:

> > Image.new  
> > NoMethodError: You have a nil object when you didn’t expect it!  
> > The error occurred while evaluating nil.tmp\_dh\_callback=  
> > from  
> > /usr/local/lib/ruby/gems/1.8/gems/rubyforge-1.0.0/lib/rubyforge/client.rb:24:in  
> > `use_ssl=' from /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.1/lib/aws/s3/connection.rb:101:in`create\_connection’  
> > from  
> > /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.1/lib/aws/s3/connection.rb:116:in  
> > `connect' from /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.1/lib/aws/s3/connection.rb:23:in`initialize’  
> > from  
> > /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.1/lib/aws/s3/connection.rb:6:in  
> > `new' from /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.1/lib/aws/s3/connection.rb:6:in`connect’  
> > from  
> > /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.1/lib/aws/s3/connection.rb:202:in  
> > `establish_connection!' from /Users/sean/Projects/onecause/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb:143:in`included’  
> > from  
> > /Users/sean/Projects/onecause/vendor/plugins/attachment\_fu/lib/technoweenie/attachment\_fu.rb:78:in  
> > `include' from /Users/sean/Projects/onecause/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:78:in`has\_attachment’  
> > from /Users/sean/Projects/onecause/app/models/image.rb:27  
> > from  
> > /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active\_support/dependencies.rb:215:in  
> > `load_without_new_constant_marking' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:215:in`load\_file’  
> > from  
> > /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active\_support/dependencies.rb:354:in  
> > `new_constants_in' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:214:in`load\_file’  
> > from  
> > /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active\_support/dependencies.rb:95:in  
> > `require_or_load' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:260:in`load\_missing\_constant’  
> > from  
> > /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active\_support/dependencies.rb:467:in  
> > `const_missing_not_from_s3_library' from /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.1/lib/aws/s3/extensions.rb:174:in`rake\_original\_const\_missing’  
> > from /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:2237:in  
> > `const_missing' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:479:in`const\_missing’  
> > from (irb):1  
> > from :0\>\>

The gems are installed and included. The amazon\_s3.yml file is  
configured correctly with the right bucket, access\_key, and  
secret\_access\_key. The model is configured like this:

has\_attachment :storage =\> :s3,  
:content\_type =\> :image,  
:max\_size =\> 500.kilobytes,  
:resize\_to =\> ‘151x195\>’,  
:thumbnails =\> { :thumbnail =\> ‘100x100\>’}

Any ideas? I can’t find mention of tmp\_dh\_callback anywhere. If I  
use the same amazon\_s3.yml in a new Rails tree, everything works fine,  
so it’s not the network or my machine in particular.

Thanks!

Sean

---

<div class="post-metadata">

**Author:** ![seanhussey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a88e57/32.png) [@seanhussey](https://www.ruby-forum.com/u/seanhussey)\
**Post date:** [July 28, 2008, 8:00pm UTC](https://www.ruby-forum.com/t/error-configuring-s3-with-attachment-fu/144046/2 "2008-07-28T20:00:03Z")

</div>

Wow, that was it. Thanks! Is there a link where I can view the  
progress of the bug?

I’ve got several hosts I’d need to patch with this, so I unpacked the  
gem into vendor/gems, made the change, and all seems well.

Thanks again!

Sean

---

<div class="post-metadata">

**Author:** ![seanhussey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a88e57/32.png) [@seanhussey](https://www.ruby-forum.com/u/seanhussey)\
**Post date:** [July 27, 2008, 2:45pm UTC](https://www.ruby-forum.com/t/error-configuring-s3-with-attachment-fu/144046/3 "2008-07-27T14:45:16Z")

</div>

Sean H. schreef:

> `use_ssl=' from /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.1/lib/aws/s3/connection.rb:202:in from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:215:in`const\_missing\_not\_from\_s3\_library’  
> configured correctly with the right bucket, access\_key, and  
> so it’s not the network or my machine in particular.
> 
> Thanks!
> 
> Sean
> 
> >

he problem is in the rubyforge 1.0.0 gem. It patches Net:HTTP but not  
very good, making the use\_ssl=false call to cause an error. I posted a  
bug report to the rubyforge gem guys.

a quick fix is changing

@ssl\_context.tmp\_dh\_callback = proc {}

into

@ssl\_context.tmp\_dh\_callback = proc {} if flag

in the file client.rb (on my mac in  
/Library/Ruby/Gems/1.8/gems/rubyforge-1.0.0/lib/rubyforge/client.rb)
