我已经为Google Cloud Functions安装了GitHub auto-deployer,但是当我现在将我的功能推送到我的GitHub存储库时,我收到一个抽象的错误消息"The request has errors"
,其中包含以下非描述性细节。什么可能在这里特别出错?
E githubAutoDeployer [CODE] 2017-12-30 19:19:37.362
Failed to create function projects/[MY_BUCKET]/locations/us-central/functions/[MY_FUNCTION] { Error: The request has errors
at Request._callback (/user_code/node_modules/googleapis/node_modules/google-auth-library/lib/transporters.js:85:15)
at Request.self.callback (/user_code/node_modules/googleapis/node_modules/request/request.js:186:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/user_code/node_modules/googleapis/node_modules/request/request.js:1163:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/user_code/node_modules/googleapis/node_modules/request/request.js:1085:12)
at IncomingMessage.g (events.js:292:16)
at emitNone (events.js:91:20)
code: 400,
errors:
[ { message: 'The request has errors',
domain: 'global',
reason: 'badRequest' } ] }
E githubAutoDeployer [CODE] 2017-12-30 19:19:37.363 Error: The request has errors
at Request._callback (/user_code/node_modules/googleapis/node_modules/google-auth-library/lib/transporters.js:85:15)
at Request.self.callback (/user_code/node_modules/googleapis/node_modules/request/request.js:186:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/user_code/node_modules/googleapis/node_modules/request/request.js:1163:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/user_code/node_modules/googleapis/node_modules/request/request.js:1085:12)
at IncomingMessage.g (events.js:292:16)
at emitNone (events.js:91:20)
D githubAutoDeployer [CODE] 2017-12-30 19:19:37.365
Function execution took 2319 ms, finished with status code: 500
更新在堆栈跟踪中提到google-auth-library
让我觉得我的凭据可能有问题。但gcloud auth list
的输出似乎没问题:
Credentialed Accounts
ACTIVE ACCOUNT
* [MY_ID]@gmail.com
更新可能有些不同寻常的是我在我的"path":"",
有config.json
。但是后来我的index.js
直接驻留在我的存储库的顶部,所以没有指定的路径。
更新This是githubAutoDeployer
传递Google Cloud Functions的错误(遗憾的是,上游服务器的源代码显然不可用):
gcf.projects.locations.functions.create({ resource, location }, (err, operation) => {
if (err && err.errors && err.errors[0] && err.errors[0].reason === 'alreadyExists') {
// ...
} else if (err) {
console.error(`Failed to create function ${resource.name}`, err);
reject(err);
}
问题是我在我的"location" : "us-central"
中指定us-central1
而不是supports Google Cloud Functions(config.json
)。
我发现了一个原始的POST请求到Google Cloud Functions API(在获得服务帐户和访问令牌等之后)。在此级别,API返回明确的错误指示:
"fieldViolations": [
{
"field": "region",
"description": "region us-central is not supported."
}
]
显然,不幸的是,当githubAutoDeployer
尝试同一个呼叫时,这不会输入任何日志文件。