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

NVCHECKER_GITHUB_TOKEN not passed to underlying nvchecker? #86

Open
oxalica opened this issue Oct 21, 2022 · 1 comment
Open

NVCHECKER_GITHUB_TOKEN not passed to underlying nvchecker? #86

oxalica opened this issue Oct 21, 2022 · 1 comment

Comments

@oxalica
Copy link

oxalica commented Oct 21, 2022

I hit the GitHub rate limit and try to set NVCHECKER_GITHUB_TOKEN, but it seems not passed to the underlying nvchecker invocation. I still got a rate limited error.

NVCHECKER_GITHUB_TOKEN=ghp_mysurelyworkingtoken nvfetcher

Gives

...Tons of interleaving (raced) python error messages above...
nvfetcher: Error when running Shake build system:
  at want, called at src/NvFetcher.hs:158:25 in nvfetcher-0.5.0.0-1hQLo89GaTh7rCoECXTyuF:NvFetcher
* Depends on: build
* Depends on: Core ("rawmv")
  at apply1, called at src/NvFetcher/Nvchecker.hs:188:22 in nvfetcher-0.5.0.0-1hQLo89GaTh7rCoECXTyuF:NvFetcher.Nvchecker
* Depends on: CheckVersion (GitHubTag {_owner = "oxalica", _repo = "rawmv", _listOptions = ListOptions {_includeRegex = Nothing, _excludeRegex = Nothing, _sortVersionKey = Nothing, _ignored = Nothing}}) (NvcheckerOptions {_stripPrefix = Nothing, _fromPattern = Nothing, _toPattern = Nothing}) ("rawmv")
* Raised the exception:
user error (Failed to parse output from nvchecker: {"logger_name": "nvchecker.core", "name": "rawmv", "event": "unexpected error happened", "error": "HTTPError(403, 'Forbidden', HTTPResponse(_body=None,_error_is_response_code=True,buffer=<_io.BytesIO object at 0x7f2836d3a4d0>,code=403,effective_url='https://api.github.com/repos/oxalica/rawmv/git/refs/tags',error=HTTP 403: Forbidden,headers=<tornado.httputil.HTTPHeaders object at 0x7f2836d35720>,reason='Forbidden',request=<tornado.httpclient.HTTPRequest object at 0x7f2836d34340>,request_time=0.3158247470855713,start_time=1666317253.5677643,time_info={'queue': 6.985664367675781e-05, 'namelookup': 2.3e-05, 'connect': 8.2e-05, 'appconnect': 0.208817, 'pretransfer': 0.208891, 'starttransfer': 0.315421, 'total': 0.315622, 'redirect': 0.0}))", "exception": "Traceback (most recent call last):\n  File \"/nix/store/h18j4ksb1851x2lb748pryqrah3fkp3a-python3.10-nvchecker-2.9/lib/python3.10/site-packages/nvchecker/util.py\", line 262, in run_one\n    version = await self.func(\n  File \"/nix/store/h18j4ksb1851x2lb748pryqrah3fkp3a-python3.10-nvchecker-2.9/lib/python3.10/site-packages/nvchecker_source/github.py\", line 25, in get_version\n    return await get_version_real(name, conf, **kwargs)\n  File \"/nix/store/h18j4ksb1851x2lb748pryqrah3fkp3a-python3.10-nvchecker-2.9/lib/python3.10/site-packages/nvchecker_source/github.py\", line 114, in get_version_real\n    data = await cache.get_json(url, headers = headers)\n  File \"/nix/store/h18j4ksb1851x2lb748pryqrah3fkp3a-python3.10-nvchecker-2.9/lib/python3.10/site-packages/nvchecker/util.py\", line 174, in get_json\n    return await self.get(\n  File \"/nix/store/h18j4ksb1851x2lb748pryqrah3fkp3a-python3.10-nvchecker-2.9/lib/python3.10/site-packages/nvchecker/util.py\", line 201, in get\n    r = await fu\n  File \"/nix/store/h18j4ksb1851x2lb748pryqrah3fkp3a-python3.10-nvchecker-2.9/lib/python3.10/site-packages/nvchecker/util.py\", line 162, in _get_json\n    res = await session.get(url, headers=dict(headers))\n  File \"/nix/store/h18j4ksb1851x2lb748pryqrah3fkp3a-python3.10-nvchecker-2.9/lib/python3.10/site-packages/nvchecker/httpclient/base.py\", line 49, in get\n    return await self.request(\n  File \"/nix/store/h18j4ksb1851x2lb748pryqrah3fkp3a-python3.10-nvchecker-2.9/lib/python3.10/site-packages/nvchecker/httpclient/base.py\", line 79, in request\n    return await self.request_impl(\n  File \"/nix/store/h18j4ksb1851x2lb748pryqrah3fkp3a-python3.10-nvchecker-2.9/lib/python3.10/site-packages/nvchecker/httpclient/tornado_httpclient.py\", line 91, in request_impl\n    raise err_cls(\nnvchecker.httpclient.base.HTTPError: (403, 'Forbidden', HTTPResponse(_body=None,_error_is_response_code=True,buffer=<_io.BytesIO object at 0x7f2836d3a4d0>,code=403,effective_url='https://api.github.com/repos/oxalica/rawmv/git/refs/tags',error=HTTP 403: Forbidden,headers=<tornado.httputil.HTTPHeaders object at 0x7f2836d35720>,reason='Forbidden',request=<tornado.httpclient.HTTPRequest object at 0x7f2836d34340>,request_time=0.3158247470855713,start_time=1666317253.5677643,time_info={'queue': 6.985664367675781e-05, 'namelookup': 2.3e-05, 'connect': 8.2e-05, 'appconnect': 0.208817, 'pretransfer': 0.208891, 'starttransfer': 0.315421, 'total': 0.315622, 'redirect': 0.0}))", "level": "error"}
)

I manually curl the failed URL with my token and it succeeds.

BTW: The encrypted error message also deserves a fix though.

@berberman
Copy link
Owner

I don't think nvchecker accepts GitHub token from environment variable like that. You may want to create a keyfile.toml which contains the token, and pass it using -k when running nvfetcher.

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

2 participants