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

NameError: uninitialized constant Octokit::RateLimit #1422

Closed
collinsauve opened this issue May 27, 2022 · 1 comment
Closed

NameError: uninitialized constant Octokit::RateLimit #1422

collinsauve opened this issue May 27, 2022 · 1 comment
Assignees
Labels
Type: Bug Something isn't working as documented

Comments

@collinsauve
Copy link

collinsauve commented May 27, 2022

In 4.22 we had a unit test that raised this error, so we could test that our code behaved accordingly. With the upgrade to 4.23, when we try to

raise Octokit::TooManyRequests

we get the following:

NameError: uninitialized constant Octokit::RateLimit

     @context = Octokit::RateLimit.from_response(@response)
                       ^^^^^^^^^^^
from ~/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/octokit-4.23.0/lib/octokit/error.rb:39:in `build_error_context'

This can be reproduced easily with a new project that only depends on Octokit 4.23, and using pry to raise it. I have put together a repository with that reproduction here:

https://github.com/collinsauve/Octokit-toomanyrequests-error

Additionally, the same issue cannot be reproduced in 4.22 as shown in this branch of that repository:

https://github.com/collinsauve/Octokit-toomanyrequests-error/tree/4.22

timrogers added a commit that referenced this issue Jun 5, 2022
`Octokit::Error#build_error_context` uses `RateLimit.from_
response` but does not require the file for `RateLimit`
explicitly.

This can lead to cases where the `RateLimit` module is not
available when needed, causing an error.

This requires the file explicitly where the module is used.

Fixes #1422.
timrogers added a commit that referenced this issue Jun 5, 2022
`Octokit::Error#build_error_context` uses `RateLimit.from_
response` but does not require the file containing
`RateLimit` explicitly.

This can lead to cases where the `RateLimit` module is not
available when needed, causing an error. This requires the
file explicitly where the module is used.

Fixes #1422.
@nickfloyd nickfloyd self-assigned this Jun 6, 2022
@nickfloyd nickfloyd added the bug label Jun 6, 2022
@nickfloyd
Copy link
Contributor

Fixed in release v4.24.0

@nickfloyd nickfloyd added Type: Bug Something isn't working as documented and removed bug labels Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working as documented
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants