Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to authorize tugboat #79

Closed
rained23 opened this issue Dec 5, 2013 · 4 comments · Fixed by #80
Closed

Unable to authorize tugboat #79

rained23 opened this issue Dec 5, 2013 · 4 comments · Fixed by #80

Comments

@rained23
Copy link

rained23 commented Dec 5, 2013

I tried to authorize it but I receive the following error

I, [2013-12-06T04:14:35.580345 #6046]  INFO -- : Started GET request to: https://api.digitalocean.com/droplets?client_id=[CLIENT-ID]&api_key=[API-KEY]
D, [2013-12-06T04:14:35.580483 #6046] DEBUG -- : Request Headers:
----------------
User-Agent : Faraday v0.8.8

Request Body:
-------------


uninitialized constant JSON::Parser!
/Users/me/.rvm/gems/ruby-2.0.0-p247/gems/tugboat-0.0.8/lib/tugboat/middleware/authentication_middleware.rb:24:in `rescue in call': undefined method `status' for #<String:0x007f9a33876700> (NoMethodError)
@petems
Copy link
Owner

petems commented Dec 6, 2013

Hmm, I think I've seen this before when Digital Ocean was having issues. Plus it looks like the response body was empty.

But we could probably fix the wrapper around the authentication_middleware so you don't get the undefined method status bit...

In fact, can you run

curl -v https://api.digitalocean.com/droplets?client_id=[CLIENT-ID]&api_key=[API-KEY]

And see what you get? Removing your keys and personal info 👍

@rained23
Copy link
Author

rained23 commented Dec 6, 2013

@petems below is the output I get from those command

curl -v "https://api.digitalocean.com/droplets?client_id=xxx&api_key=yyy"
* Adding handle: conn: 0x7f8f29804000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7f8f29804000) send_pipe: 1, recv_pipe: 0
* About to connect() to api.digitalocean.com port 443 (#0)
*   Trying 192.241.164.36...
* Connected to api.digitalocean.com (192.241.164.36) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
* Server certificate: *.digitalocean.com
* Server certificate: Go Daddy Secure Certification Authority
* Server certificate: Go Daddy Class 2 Certification Authority
> GET /droplets?client_id=xxx&api_key=yyy HTTP/1.1
> User-Agent: curl/7.30.0
> Host: api.digitalocean.com
> Accept: */*
>
< HTTP/1.1 200 OK
* Server nginx is not blacklisted
< Server: nginx
< Date: Fri, 06 Dec 2013 04:31:25 GMT
< Content-Type: application/json; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Status: 200 OK
< ETag: "566daad36de61362a05b13ae6bf51ff1"
< Cache-Control: max-age=0, private, must-revalidate
< X-Request-Id: 3b3d4afac461c757ac0d94701442742e
< X-Runtime: 0.150938
< X-Rack-Cache: miss
<
* Connection #0 to host api.digitalocean.com left intact
{"status":"OK","droplets":[]}%

@rained23
Copy link
Author

rained23 commented Dec 6, 2013

Hi, I got this fixed by adding

require 'json'

inside authentication_middleware.rb , json gem are not loaded ?

can I know why the gem didn't have the latest update like the github version ?

by the way I am using ruby 2.0.0p247


Update

Another way to solve this by upgrading my Ruby to p535

@petems
Copy link
Owner

petems commented Dec 6, 2013

Interesting, I've seen weird requirement issues with json in Ruby before?

Might be something to think about just adding in require 'json to the top anyway for people running p247.

Glad it's working for you now anyways! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants