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

https://api.bitbucket.org/1.0/user/repositories endpoint stopped working #71

Open
jimmykarily opened this issue Jun 10, 2016 · 4 comments

Comments

@jimmykarily
Copy link
Contributor

Something strange happens with this endpoint.
Net::HTTP throws EOFError which results in the following exception being raise from Faraday:

 end of file reached (Faraday::ConnectionFailed)

To reproduce simply run the following on latests master:

client = BitBucket.new(oauth_token: bitbucket_access_token, oauth_secret: bitbucket_access_token_secret)

client.user_api.repositories

The strange thing is that if I replace the API url from "https://api.bitbucket.org" to "https://bitbucket.org/api" it works. I compared the two requests and they are the same (except for the different url). This must have happened today because yesterday I'm sure it was working.

To make it more complicated, both urls behave the same when I use Postman (they both work) so I can't open an issue on Bitbucket for this. I turned debugging on with set_debug_output($stdout) on Net::HTTP and the only difference is the error:

Failing debug output:

opening connection to api.bitbucket.org:443...
opened
starting SSL for api.bitbucket.org:443...
SSL established
Net::HTTP#set_debug_output called after HTTP started
<- "GET /1.0/user/repositories HTTP/1.1\r\nUser-Agent: BitBucket Ruby Gem 0.1.7\r\nAuthorization: OAuth oauth_consumer_key=\"sensitive_credentials_here\", oauth_nonce=\"f3edbddd965663cf27a93a67aaedeede\", oauth_signature=\"vT0VE7diL0myLGQWwMI0PfyFKoI%3D\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1465571418\", oauth_token=\"sensitive_credentials\", oauth_version=\"1.0\"\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nConnection: close\r\nHost: api.bitbucket.org\r\n\r\n"
Conn close because of error end of file reached, and retry
opening connection to api.bitbucket.org:443...
opened
starting SSL for api.bitbucket.org:443...
SSL established
<- "GET /1.0/user/repositories HTTP/1.1\r\nUser-Agent: BitBucket Ruby Gem 0.1.7\r\nAuthorization: OAuth oauth_consumer_key=\"sensitive_credentials_here\", oauth_nonce=\"f3edbddd965663cf27a93a67aaedeede\", oauth_signature=\"vT0VE7diL0myLGQWwMI0PfyFKoI%3D\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1465571418\", oauth_token=\"sensitive_credentials_here\", oauth_version=\"1.0\"\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nConnection: close\r\nHost: api.bitbucket.org\r\n\r\n"
Conn close because of error end of file reached
Conn close because of error end of file reached
/home/dimitris/.rvm/gems/ruby-2.3.0@katana/gems/spring-1.3.6/lib/spring/application.rb:156:in `fork': end of file reached (Faraday::ConnectionFailed)

Working debug output:

opening connection to bitbucket.org:443...
opened
starting SSL for bitbucket.org:443...
SSL established
Net::HTTP#set_debug_output called after HTTP started
<- "GET /api/1.0/user/repositories HTTP/1.1\r\nUser-Agent: BitBucket Ruby Gem 0.1.7\r\nAuthorization: OAuth oauth_consumer_key=\"sensitive_debug_output\", oauth_nonce=\"c3fa96d07995b57c84aedd62b3bf28d1\", oauth_signature=\"FNFPkXpOiD6AUGE97yn%2Ff53UujU%3D\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1465571438\", oauth_token=\"sensitive_debug_output\", oauth_version=\"1.0\"\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nConnection: close\r\nHost: bitbucket.org\r\n\r\n"
-> "HTTP/1.1 200 OK\r\n"
-> "Server: nginx/1.6.2\r\n"
-> "Vary: Authorization, Cookie\r\n"
-> "Vary: Accept-Encoding\r\n"
-> "Content-Type: application/json; charset=utf-8\r\n"
-> "X-OAuth-Scopes: webhook, repository:admin, repository, account\r\n"
-> "Content-Encoding: gzip\r\n"
-> "Strict-Transport-Security: max-age=31536000\r\n"
-> "Date: Fri, 10 Jun 2016 15:09:29 GMT\r\n"
-> "X-Served-By: app-111\r\n"
-> "X-Static-Version: 660dd275ada4\r\n"
-> "ETag: \"87914e45bea56a015507239d2b9c0883\"\r\n"
-> "X-Content-Type-Options: nosniff\r\n"
-> "X-Render-Time: 0.0379409790039\r\n"
-> "X-Accepted-OAuth-Scopes: repository\r\n"
-> "Connection: close\r\n"
-> "X-Version: 660dd275ada4\r\n"
-> "X-Request-Count: 156\r\n"
-> "X-Frame-Options: SAMEORIGIN\r\n"
-> "\r\n"
reading all...

...

(and the rest is the repository results in JSON format)

It seems that the first case is retried once before exiting with error.

ispyropoulos added a commit to ispyropoulos/bitbucket that referenced this issue Jun 11, 2016
This seems that "fixes" the issue with Faraday gem raising
"Faraday::ConnectionFailed: end of file reached". Remove this
commit when this issue
bitbucket-rest-api#71 gets
resolved.
@zedlang
Copy link

zedlang commented Nov 22, 2016

@jimmykarily Just as a matter of interest, have you tried this with OAuth2?

@jimmykarily
Copy link
Contributor Author

@zedlang I'm afraid I don't remember exactly what else I tried. It's been a while since I last worked on this.

@zedlang
Copy link

zedlang commented Nov 29, 2016

@jimmykarily Ah, I just wondered. I couldn't reproduce what you were getting but I was using OAuth2 rather than OAuth and I wondered if it might be something to do with that

@jottenlips
Copy link

Has anyone tried using the 2.0 version of Bitbucket's API? I am also getting this timeout error. https://bitbucket.org/site/master/issues/12051/request-timeout-when-getting-branches-api

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

No branches or pull requests

3 participants