0

I have some code that accesses an MLS listing service and downloads pictures into AWS. I am getting the error on MLS login. I'm on ruby 2.2.2p95 and rails 3.2.22.

My code:

AWS::S3::Base.establish_connection!(
    :access_key_id => ACCESS_KEY_ID,
    :secret_access_key => SECRET_ACCESS_KEY
  )

  puts 'connected to AWS'

  client = Rets::Client.new({
   login_url: LOGIN_URL,
   username: LOGIN,
   password: PASSWORD,
   version: VERSION
   })

 begin
    client.login
#  rescue => e
#     puts 'Error: ' + e.message
#     exit!
 end

The error:

➜  LiveByTransit git:(master) ✗ rake update_pics --trace
** Invoke update_pics (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute update_pics
66
connected to AWS
rake aborted!
TypeError: no implicit conversion of nil into String
/home/nitrous/code/LiveByTransit/.bundle/gems/nokogiri-1.6.6.3/lib/nokogiri/xml/document.rb:55:in `read_memory'
/home/nitrous/code/LiveByTransit/.bundle/gems/nokogiri-1.6.6.3/lib/nokogiri/xml/document.rb:55:in `parse'
/home/nitrous/code/LiveByTransit/.bundle/gems/nokogiri-1.6.6.3/lib/nokogiri/xml.rb:64:in `parse'
/home/nitrous/code/LiveByTransit/.bundle/gems/rets-0.9.0/lib/rets/parser/error_checker.rb:17:in `check'
/home/nitrous/code/LiveByTransit/.bundle/gems/rets-0.9.0/lib/rets/http_client.rb:20:in `http_get'
/home/nitrous/code/LiveByTransit/.bundle/gems/rets-0.9.0/lib/rets/client.rb:344:in `http_get'
/home/nitrous/code/LiveByTransit/.bundle/gems/rets-0.9.0/lib/rets/client.rb:63:in `login'
/home/nitrous/code/LiveByTransit/lib/tasks/update_pics.rake:45:in `block in <top (required)>'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:240:in `call'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:240:in `block in execute'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:235:in `each'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:235:in `execute'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:165:in `invoke'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:150:in `invoke_task'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:106:in `block (2 levels) in top_level'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:106:in `each'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:106:in `block in top_level'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:115:in `run_with_threads'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:100:in `top_level'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:78:in `block in run'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:75:in `run'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
.bundle/binstubs/rake:16:in `load'
.bundle/binstubs/rake:16:in `<main>'
Tasks: TOP => update_pics
➜  LiveByTransit git:(master) ✗ ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
➜  LiveByTransit git:(master) ✗ rails -v
Rails 3.2.22

In my code above, you'll see I commented out the error rescue. If I comment back in, the error looks like this:

➜  LiveByTransit git:(master) ✗ rake update_pics --trace
** Invoke update_pics (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute update_pics
66
connected to AWS
Error: no implicit conversion of nil into String
➜  LiveByTransit git:(master) ✗

I've tried this suggestion with no change.

5
  • What is contained in the VERSION variable?
    – dj_goku
    Dec 1, 2015 at 1:29
  • Wait are you able to connect? But after going through objects it is failing? Is 66 the number of images?
    – dj_goku
    Dec 1, 2015 at 1:32
  • The VERSION variable is the version of RETS used by the MLS. I am not able to connect, and I think it is a problem with my code vs a problem with the MLS. I am able to connect to the MLS outside of my app with the same code. 66 is the number of listings that need a picture update. This code used to work, but I updated my version of ruby and I think this is creating problems.
    – tomb
    Dec 1, 2015 at 16:03
  • @tomb did you fix this? What did you do?
    – knagode
    Feb 21, 2019 at 17:09
  • @knagode, the code is working now, and it looks like I log into the Rets server first, then establish the connection to AWS. Not sure if that is the silver bullet. Happy to send a code sample if that doesn't work.
    – tomb
    Feb 22, 2019 at 19:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.