I am downloading a file from Amazon S3 into the tmp directory of my
heroku dyno.  I am using aws-s3 and downloading using the following
code:

def s3_get_file(filename, bucket_name)
    logger.debug "S3 - Streaming #{filename} from bucket
#{bucket_name} to temp"
    temp = Tempfile.new("s3")

    File.open(temp.path, 'wb') do |file|
      AWS::S3::S3Object.stream(filename, bucket_name) { |segment|
        file << segment
      }
    end

    temp.path
end

This works fine on my local machine but when running on heroku I get
the following exception.

2012-03-24T02:18:12+00:00 app[web.1]:
REXML::UndefinedNamespaceException (Undefined prefix Net: found):
2012-03-24T02:18:12+00:00 app[web.1]:   app/controllers/
application_controller.rb:73:in `block in s3_get_file'
2012-03-24T02:18:12+00:00 app[web.1]:   app/controllers/
application_controller.rb:72:in `open'
2012-03-24T02:18:12+00:00 app[web.1]:   app/controllers/
application_controller.rb:72:in `s3_get_file'

Line 73 is the S3Object.stream call.

Any ideas what is going on here.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to