[s3-dev] ArgumentError using AWS-S3

Ivan ivan at ivaner.com
Tue Jul 1 15:43:50 EDT 2008


I'm having trouble getting my rails app to use AWS/S3.
I believe that I'm pretty close, but can't seem to get past finding a
bucket.
I've enclosed the function I'm trying to use, and the resulting output
error...

I have this running on a shared host, and I have the following
declared in the environment.rb:
require 'rubygems'
require 'aws/s3'

Thanks in advance for any help provided,
Ivan


 def upload_AWS

     # Connect to S3
     logger.info "*** Connecting to S3 ***"
     conn = AWS::S3::Base.establish_connection!(:access_key_id =>
'XXmyaccesskeyidXX', :secret_access_key => 'XXmysecretaccesskeyXX',
:persistent => true)

      unless conn
         logger.info "*** NO CONNECTION :***"
      else
         logger.info " *** CONNECTION! ***"
      end

     # find bucket
     logger.info "*** Finding out bucket ***"
        bucket = AWS::S3::Bucket.find('XXmybucketnameXX')
     unless bucket
        logger.info "*** Couldn't find bucket ***"
     end

     # upload file
     logger.info "*** Uploading our file ***"
     logger.info "*** The file name is: " + filename
     if AWS::S3::S3Object.store(filename, open(filename),
'XXmybucketnameXX')
     logger.info "*** File upload successful ***"
     end
 end


OUTPUT:

*** Connecting to S3 ***
 *** CONNECTION! ***
*** Finding out bucket ***
  [4;35;1mSQL (0.012269) [0m    [0mROLLBACK [0m


ArgumentError (wrong number of arguments (1 for 0)):

 /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.0/lib/aws/s3/extensions.rb:109:in
`__method__'

 /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.0/lib/aws/s3/extensions.rb:109:in
`memoize'

 /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.0/lib/aws/s3/extensions.rb:144:in
`canonical_string'

 /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.0/lib/aws/s3/authentication.rb:72:in
`encoded_canonical'

 /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.0/lib/aws/s3/authentication.rb:94:in
`initialize'

 /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.0/lib/aws/s3/connection.rb:130:in
`new'

 /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.0/lib/aws/s3/connection.rb:130:in
`authenticate!'

 /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.0/lib/aws/s3/connection.rb:34:in
`request'

 /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.0/lib/aws/s3/connection.rb:50:in
`call'

 /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.0/lib/aws/s3/connection.rb:50:in
`request'
   /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.0/lib/aws/s3/base.rb:69:in
`request'
   /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.0/lib/aws/s3/base.rb:83:in
`get'

 /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.5.0/lib/aws/s3/bucket.rb:102:in
`find'
   /app/models/song.rb:129:in `upload_AWS'
   /app/models/song.rb:98:in `process'

 /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:307:in
`send'

 /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:307:in
`callback'

 /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:304:in
`each'

 /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:304:in
`callback'

 /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:214:in
`create_or_update'

 /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1972:in
`save_without_validation'

 /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/validations.rb:934:in
`save_without_transactions'

 /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in
`save'

 /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in
`transaction'

 /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:80:in
`transaction'

 /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:100:in
`transaction'

 /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in
`save'

 /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:120:in
`rollback_active_record_state!'

 /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in
`save'

 /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:572:in
`create'
   /app/controllers/songs_controller.rb:9:in `create'

 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in
`send'

 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in
`perform_action_without_filters'

 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:in
`call_filters'

 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in
`perform_action_without_benchmark'

 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
   /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'

 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'

 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in
`perform_action_without_caching'

 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in
`perform_action'

 /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in
`cache'

 /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in
`cache'

 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in
`perform_action'

 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in
`send'

 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in
`process_without_filters'

 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in
`process_without_session_management_support'

 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in
`process'

 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in
`process'

 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in
`handle_request'

 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in
`dispatch'

 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in
`dispatch_cgi'

 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in
`dispatch'
   dispatch.cgi:10
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/amazon-s3-dev/attachments/20080701/a3940680/attachment-0001.html>


More information about the amazon-s3-dev mailing list