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

Can't List Organization's Repos #134

Open
brotatos opened this issue Sep 19, 2013 · 5 comments
Open

Can't List Organization's Repos #134

brotatos opened this issue Sep 19, 2013 · 5 comments

Comments

@brotatos
Copy link

After I run this script:

require 'github_api'                                     

github = Github.new oauth_token: `git config github.token`
github.repos.list org: 'iFixit'                           

I get this error:

/home/robin/build/lib/ruby/gems/1.9.1/gems/multi_json-1.8.0/lib/multi_json/adapters/yajl.rb:11:in `parse': lexical error: invalid char in json text. (MultiJson::LoadError)
                                       <html><body><h1>400 Bad request
                     (right here) ------^
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/multi_json-1.8.0/lib/multi_json/adapters/yajl.rb:11:in `load'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/multi_json-1.8.0/lib/multi_json/adapter.rb:20:in `load'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/multi_json-1.8.0/lib/multi_json.rb:120:in `load'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/github_api-0.10.2/lib/github_api/jsonable.rb:12:in `decode'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/github_api-0.10.2/lib/github_api/error/service_error.rb:26:in `decode_body'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/github_api-0.10.2/lib/github_api/error/service_error.rb:33:in `parse_body'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/github_api-0.10.2/lib/github_api/error/service_error.rb:20:in `parse_response'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/github_api-0.10.2/lib/github_api/error/service_error.rb:15:in `initialize'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/github_api-0.10.2/lib/github_api/error/bad_request.rb:10:in `initialize'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/github_api-0.10.2/lib/github_api/response/raise_error.rb:14:in `new'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/github_api-0.10.2/lib/github_api/response/raise_error.rb:14:in `on_complete'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/response.rb:9:in `block in call'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/response.rb:63:in `on_complete'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/response.rb:8:in `call'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/response.rb:8:in `call'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/response.rb:8:in `call'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/github_api-0.10.2/lib/github_api/request/oauth2.rb:24:in `call'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/request/url_encoded.rb:14:in `call'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/request/multipart.rb:13:in `call'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/github_api-0.10.2/lib/github_api/request/jsonize.rb:18:in `call'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/connection.rb:253:in `run_request'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/connection.rb:106:in `get'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/github_api-0.10.2/lib/github_api/request.rb:44:in `request'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/github_api-0.10.2/lib/github_api/request.rb:12:in `get_request'
    from /home/robin/build/lib/ruby/gems/1.9.1/gems/github_api-0.10.2/lib/github_api/repos.rb:149:in `list'
    from ./testing.rb:6:in `<main>'
@serv
Copy link

serv commented Oct 2, 2013

I started to get something similar as well today.

Here is the error message.

MultiJson::LoadError
795: unexpected token at '<html><body><h1>502 Bad Gateway</h1>
The server returned an invalid or incomplete response.
</body></html>

I get this message when I do this.

github = Github.new(:oauth_token => '89abc...........')
commits = github.repos.commits.all('big-corp-name', 'some-repo-name')

My Ruby version is ruby 2.0.0p247 and rails is Rails 3.2.13

@serv
Copy link

serv commented Oct 2, 2013

I also noticed that this problem occurs intermittently. It works one minute and stops working the next and suddenly work again.

@jmtame
Copy link

jmtame commented Mar 5, 2015

I can't get any of the repos for one of my orgs. It's only showing my public repos. I can't access scopes either.

@CpuID
Copy link

CpuID commented Jun 15, 2015

I noticed that this fails when using user and oauth_token on the Github.new call. If you try something like:

github = Github.new do |config|
  config.basic_auth = "#{user}:#{oauth_token}"
end

You will get all repositories as expected.

@pillarsdotnet
Copy link

We have two organizations. Some repos were created in org "A" and subsequently forked to org "B".
Some repos were created in org "B" and subsequently forked to org "A".

When I list all repos in org "A" I don't find the forked copies of repos that originated with org "B".

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

5 participants