[BUG]: Commit not found when it exists
What happened?
When calling getCommit() with valid parameters, I'm getting a 404 error. I noticed in the log that it called the endpoint:
https://:host/api/v3/repos/:org/:repo/git/commits?sha={sha}
I was unable to find this in the REST documentation. However, in the REST documentation, the endpoint for getting a single commit is:
https://:host/api/v3/repos/:org/:repo/commits/:sha
When I call this endpoint with the same sha, I get a result.
This is against GitHub Enterprise 3.10.1. It's also worth noting that in the particular case, the sha im trying to look up is on a branch being PR'd. Not sure if that matters. Like I said, the endpoint that octokit uses vs. the documented endpoint suceeeds.
Versions
octokit-core.js/5.1.0 Node.js/20.8.1
Relevant log output
{
status: 404,
response: {
url: 'https://!!redacted!!/api/v3/repos/MyOrg/my-repo/git/commits?sha=3f2eb6269eeee22fa62b0d70fd851874eb0298ae',
status: 404,
headers: {
'access-control-allow-origin': '*',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
'content-encoding': 'gzip',
'content-security-policy': "default-src 'none'",
'content-type': 'application/json; charset=utf-8',
date: 'Thu, 08 Feb 2024 19:12:29 GMT',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
server: 'GitHub.com',
'strict-transport-security': 'max-age=31536000; includeSubdomains',
'transfer-encoding': 'chunked',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-api-version-selected': '2022-11-28',
'x-github-enterprise-version': '3.10.1',
'x-github-media-type': 'github.v3; format=json',
'x-github-request-id': '61347356-e8cf-4224-ade7-efeb767f2c5b',
'x-xss-protection': '0'
},
data: {
message: 'Not Found',
documentation_url: 'https://docs.github.com/[email protected]/rest'
}
},
request: {
method: 'GET',
url: 'https://!!redacted!!/api/v3/repos/MyOrg/my-repo/git/commits?sha=3f2eb6269eeee22fa62b0d70fd851874eb0298ae',
headers: {
accept: 'application/vnd.github.v3+json',
'user-agent': 'octokit-core.js/5.1.0 Node.js/20.8.1 (linux; x64)',
authorization: 'token [REDACTED]'
},
request: {
agent: Agent {
_events: [Object: null prototype] {
free: [Function (anonymous)],
newListener: [Function: maybeEnableKeylog]
},
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object: null prototype] {
keepAlive: true,
scheduling: 'lifo',
timeout: 5000,
noDelay: true,
path: null
},
requests: [Object: null prototype] {},
sockets: [Object: null prototype] {},
freeSockets: [Object: null prototype] {},
keepAliveMsecs: 1000,
keepAlive: true,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: 'lifo',
maxTotalSockets: Infinity,
totalSocketCount: 0,
maxCachedSessions: 100,
_sessionCache: { map: {}, list: [] },
[Symbol(kCapture)]: false
},
fetch: [Function: proxyFetch],
hook: [Function: bound bound register]
}
}
}
Node.js v20.8.1
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀
Are you using the appropriate plugin for GHES? https://github.com/octokit/plugin-enterprise-server.js/