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

User not found leads to runtime exception #131

Open
yegor256 opened this issue Sep 17, 2024 · 8 comments
Open

User not found leads to runtime exception #131

yegor256 opened this issue Sep 17, 2024 · 8 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@yegor256
Copy link
Member

I found this problem here:

Octokit::Forbidden: GET https://api.github.com/user/29139614: 403 - Resource not accessible by integration // See: https://docs.github.com/rest
	/usr/local/bundle/gems/octokit-9.1.0/lib/octokit/response/raise_error.rb:14:in `on_complete'
	/usr/local/bundle/gems/faraday-2.10.1/lib/faraday/middleware.rb:57:in `block in call'
	/usr/local/bundle/gems/faraday-2.10.1/lib/faraday/response.rb:42:in `on_complete'
	/usr/local/bundle/gems/faraday-2.10.1/lib/faraday/middleware.rb:56:in `call'
	/usr/local/bundle/gems/faraday-http-cache-2.5.1/lib/faraday/http_cache.rb:286:in `fetch'
	/usr/local/bundle/gems/faraday-http-cache-2.5.1/lib/faraday/http_cache.rb:190:in `process'
	/usr/local/bundle/gems/faraday-http-cache-2.5.1/lib/faraday/http_cache.rb:141:in `call!'
	/usr/local/bundle/gems/faraday-http-cache-2.5.1/lib/faraday/http_cache.rb:121:in `call'
	/usr/local/bundle/gems/fbe-0.0.53/lib/fbe/middleware/quota.rb:48:in `call'
	/usr/local/bundle/gems/faraday-retry-2.2.1/lib/faraday/retry/middleware.rb:153:in `call'
	/usr/local/bundle/gems/faraday-2.10.1/lib/faraday/rack_builder.rb:152:in `build_response'
	/usr/local/bundle/gems/faraday-2.10.1/lib/faraday/connection.rb:444:in `run_request'
	/usr/local/bundle/gems/faraday-2.10.1/lib/faraday/connection.rb:200:in `get'
	/usr/local/bundle/gems/sawyer-0.9.2/lib/sawyer/agent.rb:[99](https://github.com/zerocracy/judges-action/actions/runs/10900854041/job/30249395419#step:6:100):in `call'
	/usr/local/bundle/gems/octokit-9.1.0/lib/octokit/connection.rb:156:in `request'
	/usr/local/bundle/gems/octokit-9.1.0/lib/octokit/connection.rb:19:in `get'
	/usr/local/bundle/gems/octokit-9.1.0/lib/octokit/client/users.rb:34:in `user'
	/usr/local/bundle/gems/verbose-0.0.2/lib/verbose.rb:48:in `method_missing'
	/usr/local/bundle/gems/fbe-0.0.53/lib/fbe/octo.rb:115:in `user_name_by_id'
	/home/judges/add-user-names/add-user-names.rb:31:in `block (2 levels) in <top (required)>'Octokit::Forbidden: GET https://api.github.com/user/29139614: 403 - Resource not accessible by integration // See: https://docs.github.com/rest
	/usr/local/bundle/gems/octokit-9.1.0/lib/octokit/response/raise_error.rb:14:in `on_complete'
	/usr/local/bundle/gems/faraday-2.10.1/lib/faraday/middleware.rb:57:in `block in call'
	/usr/local/bundle/gems/faraday-2.10.1/lib/faraday/response.rb:42:in `on_complete'
	/usr/local/bundle/gems/faraday-2.10.1/lib/faraday/middleware.rb:56:in `call'
	/usr/local/bundle/gems/faraday-http-cache-2.5.1/lib/faraday/http_cache.rb:286:in `fetch'
	/usr/local/bundle/gems/faraday-http-cache-2.5.1/lib/faraday/http_cache.rb:190:in `process'
	/usr/local/bundle/gems/faraday-http-cache-2.5.1/lib/faraday/http_cache.rb:141:in `call!'
	/usr/local/bundle/gems/faraday-http-cache-2.5.1/lib/faraday/http_cache.rb:121:in `call'
	/usr/local/bundle/gems/fbe-0.0.53/lib/fbe/middleware/quota.rb:48:in `call'
	/usr/local/bundle/gems/faraday-retry-2.2.1/lib/faraday/retry/middleware.rb:153:in `call'
	/usr/local/bundle/gems/faraday-2.10.1/lib/faraday/rack_builder.rb:152:in `build_response'
	/usr/local/bundle/gems/faraday-2.10.1/lib/faraday/connection.rb:444:in `run_request'
	/usr/local/bundle/gems/faraday-2.10.1/lib/faraday/connection.rb:200:in `get'
	/usr/local/bundle/gems/sawyer-0.9.2/lib/sawyer/agent.rb:[99](https://github.com/zerocracy/judges-action/actions/runs/10900854041/job/30249395419#step:6:100):in `call'
	/usr/local/bundle/gems/octokit-9.1.0/lib/octokit/connection.rb:156:in `request'
	/usr/local/bundle/gems/octokit-9.1.0/lib/octokit/connection.rb:19:in `get'
	/usr/local/bundle/gems/octokit-9.1.0/lib/octokit/client/users.rb:34:in `user'
	/usr/local/bundle/gems/verbose-0.0.2/lib/verbose.rb:48:in `method_missing'
	/usr/local/bundle/gems/fbe-0.0.53/lib/fbe/octo.rb:115:in `user_name_by_id'
	/home/judges/add-user-names/add-user-names.rb:31:in `block (2 levels) in <top (required)>'

Probably, the user is deleted and that's why we fail.

@yegor256 yegor256 added bug Something isn't working help wanted Extra attention is needed labels Sep 17, 2024
@Yegorov
Copy link

Yegorov commented Sep 17, 2024

@yegor256 As I see this error refers to this project, see this line:

/home/judges/add-user-names/add-user-names.rb:31:in `block (2 levels) in <top (required)>'Octokit::Forbidden

Maybe this issue needs to be transferred to that project?
If I understand it correctly, then it is necessary to ignore Octokit::ClientError exception here
Can i fix it?

@yegor256 yegor256 transferred this issue from zerocracy/judges-action Sep 17, 2024
@yegor256
Copy link
Member Author

@Yegorov you are right, transferred

@yegor256
Copy link
Member Author

@Yegorov maybe it's possible to check the presence of a user via GitHub API? Just ignoring all client errors is not a good idea.

@Yegorov
Copy link

Yegorov commented Sep 18, 2024

@yegor256 it was a false assumption that the user was deleted or not found

octo.user(29139614)
GET https://api.github.com/user/29139614
D: Octokit::Client.user(29139614) in 512ms
 =>
{:login=>"renovate[bot]",
 :id=>29139614,

If the user does not exist, then there must be an error: 404 - Not Found

octo.user(11)
D: Octokit::Client.user(11) in 454ms
/home/artem/.rvm/gems/ruby-3.3.4/gems/octokit-9.1.0/lib/octokit/response/raise_error.rb:14:in `on_complete': GET https://api.github.com/user/11: 404 - Not Found // See: https://docs.github.com/rest (Octokit::NotFound)
        from /home/artem/.rvm/gems/ruby-3.3.4/gems/faraday-2.10.1/lib/faraday/middleware.rb:57:in `block in call'
        from /home/artem/.rvm/gems/ruby-3.3.4/gems/faraday-2.10.1/lib/faraday/response.rb:42:in `on_complete'
        from /home/artem/.rvm/gems/ruby-3.3.4/gems/faraday-2.10.1/lib/faraday/middleware.rb:56:in `call'
        from /home/artem/.rvm/gems/ruby-3.3.4/gems/faraday-http-cache-2.5.1/lib/faraday/http_cache.rb:286:in `fetch'
        from /home/artem/.rvm/gems/ruby-3.3.4/gems/faraday-http-cache-2.5.1/lib/faraday/http_cache.rb:190:in `process'
        from /home/artem/.rvm/gems/ruby-3.3.4/gems/faraday-http-cache-2.5.1/lib/faraday/http_cache.rb:141:in `call!'
        from /home/artem/.rvm/gems/ruby-3.3.4/gems/faraday-http-cache-2.5.1/lib/faraday/http_cache.rb:121:in `call'
        from /home/artem/projects2/zerocracy/fbe/lib/fbe/middleware/quota.rb:48:in `call'

Error 403 - Resource not accessible by integration based on the documentation is related to rate limiting:

If you exceed your primary rate limit, you will receive a 403 Forbidden or 429 Too Many Requests response, and the x-ratelimit-remaining header will be 0. If you exceed a secondary rate limit, you will receive a 403 Forbidden or 429 Too Many Requests response and an error message that indicates that you exceeded a secondary rate limit.

We cannot find out why Github answered with this 403 Forbidden error and not 429 Too Many Requests because there was no logger

I propose to implement logging only answers with statuses of more than 400 to find out the cause of this error.
What do you think?

@yegor256
Copy link
Member Author

yegor256 commented Sep 19, 2024

@Yegorov I like the idea of making logging more verbose. Now, we use Loog::NULL, while loog is provided as an argument of Fbe.octo. This looks wrong. However, just passing loog instead of Loog::NULL may lead to very verbose log output. Try to fix this, but be aware of the problem: logs must not be noisy when loog is Loog::REGULAR.

@yegor256
Copy link
Member Author

@rultor release, tag is 0.0.35

@rultor
Copy link
Contributor

rultor commented Sep 23, 2024

@rultor release, tag is 0.0.35

@yegor256 OK, I will release it now. Please check the progress here

@rultor
Copy link
Contributor

rultor commented Sep 23, 2024

@rultor release, tag is 0.0.35

@yegor256 Done! FYI, the full log is here (took me 34min)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants