2021-01-19T16:58:27.528Z 784f32d9-df03-522b-86b6-6a58cee71a88 ERROR RequestError [HttpError]: If you would like to help us test the Checks API during its preview period, you must specify a custom media type in the 'Accept' header. Please see the docs for full details.
可能由 #386 引起
建议我们暂时恢复#386。
已解决 #481
我仍然收到此错误。 昨天在#481 合并后以及刚刚发布的 0.9.0 lambda zip 之后,我试图自己构建 lambda。
2021-01-21T18:33:14.240Z 66df9451-e423-5303-ab9e-ccd22f36bbf2 ERROR RequestError [HttpError]: If you would like to help us test the Checks API during its preview period, you must specify a custom media type in the 'Accept' header. Please see the docs for full details.
at /var/task/index.js:2756:23
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
status: 415,
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-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset',
'alt-svc': 'clear',
connection: 'close',
'content-length': '288',
'content-security-policy': "default-src 'none'",
'content-type': 'application/json; charset=utf-8',
date: 'Thu, 21 Jan 2021 18:33:14 GMT',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
server: 'GitHub.com',
status: '415 Unsupported Media Type',
'strict-transport-security': 'max-age=31536000; includeSubdomains',
via: '1.1 google',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-enterprise-version': '2.22.6',
'x-github-media-type': 'github.v3; format=json',
'x-github-request-id': '197c6068-c1d5-43d2-9ed4-bb0d409b2500',
'x-ratelimit-limit': '12500',
'x-ratelimit-remaining': '12036',
'x-ratelimit-reset': '1611255703',
'x-runtime-rack': '0.038530',
'x-xss-protection': '1; mode=block'
},
request: {
method: 'GET',
url: 'https://github.example.com/api/v3/repos/acme/somerepo/check-runs/68859',
headers: {
accept: 'application/vnd.github.v3+json',
'user-agent': 'octokit-rest.js/18.0.12 octokit-core.js/3.2.4 Node.js/12.20.1 (linux; x64)',
authorization: 'token [REDACTED]'
},
request: { hook: [Function: bound bound register] }
},
documentation_url: 'https://docs.github.com/enterprise/2.22/rest/reference/checks#get-a-check-run'
}
server: 'GitHub.com',
您仍在为您的 Lambda 使用较旧的提交..
不。我很确定我正在运行 lambdas v0.9.0,可以从 Github 下载。 标题server: 'GitHub.com'
是从我们公司的 GitHub Enterprise 返回的。
仍然发送标头Accept: application/vnd.github.v3+json
而不是application/vnd.github.antiope-preview+json
的原因可能是什么? ghesApiUrl
设置在https://github.com/philips-labs/terraform-aws-github-runner/blob/v0.9.0/modules/runners/lambdas/runners/src/scale-runners/ gh-auth.ts#L51 -L56。
@buamod我得到相同的server
标头。 好像很正常?
@samuelb我错过了修改将其添加到 v0.9.0 的修复程序的测试,因此我在本地修改了gh-auth.test.ts
L120:
request: mockedRequestInterface.defaults({ baseUrl: githubServerUrl, mediaType: { previews: ['antiope'] } }),
测试通过了。
我还发现您可以在 octokit 中启用调试。 log: console,
被插入到gh-auth.ts
L11 中,重新编译、上传并产生了这个:
2021-01-22T13:33:31.960Z a3e98909-2b21-52b0-9e5c-d18dfd7d23cf DEBUG request {
method: 'GET',
baseUrl: 'https://githubtest.internal/api/v3',
headers: {
accept: 'application/vnd.github.v3+json',
'user-agent': 'octokit-rest.js/18.0.9 octokit-core.js/3.2.4 Node.js/12.19.0 (linux; x64)'
},
mediaType: { format: '', previews: [ 'antiope' ] },
request: { hook: [Function: bound bound register] },
url: '/repos/{owner}/{repo}/check-runs/{check_run_id}',
check_run_id: 845,
owner: 'ActionsTest',
repo: 'repo-test'
}
标头仍然被传递,但现在设置了一个新的mediaType
。
添加log: console,
,我得到了这个:
021-01-22T15:15:21.285Z 68d40d07-e072-55a8-b924-55830e47ae02 DEBUG request {
method: 'GET',
baseUrl: 'https://github.example.com/api/v3',
headers: {
accept: 'application/vnd.github.v3+json',
'user-agent': 'octokit-rest.js/18.0.12 octokit-core.js/3.2.4 Node.js/12.20.1 (linux; x64)'
},
mediaType: { format: '', previews: [] },
request: { hook: [Function: bound bound register] },
url: '/repos/{owner}/{repo}/check-runs/{check_run_id}',
check_run_id: 69556,
owner: 'acme',
repo: 'somerepo'
}
未设置此 mediaType。
我加倍和三倍检查了结帐正确的分支。 我什至重新检查了它,删除了 lambda docker 映像等。
我只是从用户代理中看到,octokit-rest.js 版本与您的不同。 您之前建议恢复 #386 将是解决此问题的一种选择。 难道#481 实际上并没有解决这个问题,但您在使用 octokit-rest.js/18.0.9 构建它时不小心认为它已修复?
看起来我上次编译可能一直在使用缓存库。 我重新编译,得到和你一样的结果。
这个修改对我有用:
( gh-auth.ts
L8)
export async function createOctoClient(token: string, ghesApiUrl: string = ''): Promise<Octokit> {
const ocktokitOptions: OctokitOptions = {
auth: token,
log: console,
};
if (ghesApiUrl) {
ocktokitOptions.baseUrl = ghesApiUrl;
ocktokitOptions.previews = ['antiope'];
}
return new Octokit(ocktokitOptions);
}
我可以确认这对我有用👍
iff --git a/modules/runners/lambdas/runners/src/scale-runners/gh-auth.ts b/modules/runners/lambdas/runners/src/scale-runners/gh-auth.ts
index 01dc3cf..ae3720e 100644
--- a/modules/runners/lambdas/runners/src/scale-runners/gh-auth.ts
+++ b/modules/runners/lambdas/runners/src/scale-runners/gh-auth.ts
@@ -11,6 +11,7 @@ export async function createOctoClient(token: string, ghesApiUrl: string = ''):
};
if (ghesApiUrl) {
ocktokitOptions.baseUrl = ghesApiUrl;
+ ocktokitOptions.previews = ['antiope'];
}
return new Octokit(ocktokitOptions);
}
@@ -51,7 +52,6 @@ export async function createGithubAuth(
if (ghesApiUrl) {
authOptions.request = request.defaults({
baseUrl: ghesApiUrl,
- mediaType: { previews: ['antiope'] }
});
}
return await createAppAuth(authOptions)({ type: authType });
来自 CloudWatch:
2021-01-22T16:34:00.464Z 750ac5d2-fd1a-52ff-a26a-9d57fdbb2281 DEBUG request {
method: 'GET',
baseUrl: 'https://github.example.com/api/v3',
headers: {
accept: 'application/vnd.github.v3+json',
'user-agent': 'octokit-rest.js/18.0.12 octokit-core.js/3.2.4 Node.js/12.20.1 (linux; x64)'
},
mediaType: { format: '', previews: [ 'antiope' ] },
request: { hook: [Function: bound bound register] },
url: '/repos/{owner}/{repo}/check-runs/{check_run_id}',
check_run_id: 69599,
owner: 'acme',
repo: 'somerepo'
}
2021-01-22T16:34:00.841Z 750ac5d2-fd1a-52ff-a26a-9d57fdbb2281 INFO GET /repos/acme/somerepo/check-runs/69599 - 200 in 377ms
已打开 #482
创建版本0.9.1
最有用的评论
创建版本0.9.1