Closed tep closed 6 months ago
Thanks for the bug report. As I don't have any GitHub enterprise, it will be hard for me to fix it. I understand it's a uncaught error around the rate limit, so I will try to fix it in beta.
I will return to you when I tried one fix in beta. You should install the plugin with BRAT to test it.
Do you know which is the status / error code returned? So I can caught this specific error. I couldn't get any help in the documentation :/
GHE returns 404
with the following JSON body:
{
"message": "Rate limiting is not enabled.",
"documentation_url": "https://docs.github.com/enterprise-server@3.10/rest/reference/rate-limit#get-rate-limit-status-for-the-authenticated-user"
}
Thank you. I released a beta update with an attempt to fix this error! The beta version is 7.0.3-0
BRAT: Plugins : Add a beta plugin for testing
https://github.com/ObsidianPublisher/obsidian-github-publisher
Version 7.0.3-0
did not fix the issue so I cloned your repo and did a little debugging.
What I found is that this error instanceof RequestError
condition in this situation is actually false
(albeit, I can't explain why).
I fixed things but updating line 454
to be:
if settings.github.api.tiersForApi === GithubTiersVersion.entreprise && error.name === "HttpError" && error.status === 404 && error.response.data === "Rate limiting is not enabled." return 5000;
n.b. I put the enterprise test first so that short-circuiting will ignore the other conditions if GHE is not being used.
Thanks, will update the code :)
I released the last version in beta!
My apologies -- there was an error in my previous comment. This line should actually read:
&& (error as any).response.data.message === "Rate limiting is not enabled."
// ^^^^^^^
i.e. data
is an object with a message
field containing the error string.
Looks like you switched up 2 of the identifiers on line 456; you have response.message.data
but it should read response.data.message
.
Here's the complete error
object:
{
"name": "HttpError",
"status": 404,
"response": {
"url": "https://redacted.hostname.tld/api/v3/rate_limit",
"status": 404,
"headers": {
"cache-control": "no-cache",
"content-type": "application/json; charset=utf-8",
"x-accepted-oauth-scopes": "",
"x-github-media-type": "github.v3; format=json",
"x-github-request-id": "bbd23232-9b29-402e-bd1c-057acb0e9dd2",
"x-oauth-scopes": "gist, read:org, repo"
},
"data": {
"message": "Rate limiting is not enabled.",
"documentation_url": "https://docs.github.com/enterprise-server@3.10/rest/reference/rate-limit#get-rate-limit-status-for-the-authenticated-user"
}
},
"request": {
"method": "GET",
"url": "https://redacted.hostname.tld/api/v3/rate_limit",
"headers": {
"accept": "application/vnd.github.v3+json",
"user-agent": "octokit-core.js/4.2.4 Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) obsidian/1.5.8 Chrome/120.0.6099.283 Electron/28.2.3 Safari/537.36",
"authorization": "token [REDACTED]"
},
"request": {}
}
}
Argh, sorry.
Should be fixed with -4 version in beta
Looks good to me! Thank you.
Issue validation
Command used
Upload single current active note, Test the connection to the configured repository
Plugin version
7.0.2
Describe the bug
This Obsidian plugin cannot be used with a Github Enterprise instance where rate limiting has been disabled. When I attempt to do so, the Obsidian console log generates the following messages:
This is against an internal (corporate) GHE instance that has no rate limiting -- as indicated by the following output from executing
gh api --verbose /rate_limit
against the enterprise server:This same command is successful when executed against
api.github.com
:How to reproduce ?
Minimal Reproducible Example
Configuration
Relevant log output
OS
No response
Anything else?
No response
Obsidian information