0

How to run "hello" example in Asana API documentation?

C:\Users\Desktop\ruby helloTask.rb
C:/Ruby193/lib/ruby/1.9.1/net/http.rb:799:in `connect': SSL_connect returned=1 e
rrno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL
::SSL::SSLError)
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:799:in `block in connect'
        from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
        from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:799:in `connect'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:744:in `start'
        from helloTask.rb:38:in `<main>'

I tried to run the example mentioned in the Asana API documentation, errors are on the above. Where I went wrong?

Cœur
  • 37,241
  • 25
  • 195
  • 267
lxx22
  • 225
  • 7
  • 17

2 Answers2

1

(I work at Asana)

If you are using Ruby 1.9, there's a chance it's not properly finding the CA certs properly. If you are on Mac OS X, try (re)installing the curl-ca-bundle:

sudo port install curl-ca-bundle

You may also need to set http.ca_file in some cases. There's a more thorough writeup of this issue at http://martinottenwaelter.fr/2010/12/ruby19-and-the-ssl-error/

Disabling SSL verification would certainly work as well, though that's giving up a lot of the security that SSL provides since you can't be sure you're talking directly to Asana's servers.

Tim Bavaro
  • 60
  • 3
0

I had the same problem after a google I had to change the line:

http.verify_mode = OpenSSL::SSL::VERIFY_PEER

to

http.verify_mode = OpenSSL::SSL::VERIFY_NONE

hope that helps

  • Thank you. It helps! Thanks! Would you please walk me through what is going on behind this change. Why does this work? – lxx22 Jun 21 '12 at 15:36