Google Cloud Functions GitHub自动部署者说:请求有错误 [英] Google Cloud Functions GitHub auto-deployer says: The request has errors
问题描述
我已安装 GitHub自动配置器 for Google Cloud Functions,但是当我现在将我的函数推入我的GitHub存储库时,我收到一个抽象错误消息请求有错误
细节。
E githubAutoDeployer [CODE] 2017-12-30 19:19:37.362
pre>
无法创建函数项目/ [MY_BUCKET] / locations / us-central / functions / [MY_FUNCTION] {错误:请求在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)在Request.emit(events.js:191:7)处
在请求处
。< anonymous> (/user_code/node_modules/googleapis/node_modules/request/request.js:1163:10)
在emitOne(events.js:96:13)
在Request.emit(events.js:188: 7)IncomingMessage
。< anonymous> (/user_code/node_modules/googleapis/node_modules/request/request.js:1085:12)
IncomingMessage.g(events.js:292:16)
at emitNone(events.js:91: 20)
代码:400,
错误:
[{message:'请求有错误',
域:'global',
原因:'badRequest' }]}
E githubAutoDeployer [CODE] 2017-12-30 19:19:37.363错误:请求在Request._callback上有错误
(/ user_code / node_modules / googleapis / node_modules / google-auth- 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)在Request.emit(events.js:191:7)处
在请求处
。< anonymous> (/user_code/node_modules/googleapis/node_modules/request/request.js:1163:10)
在emitOne(events.js:96:13)
在Request.emit(events.js:188: 7)IncomingMessage
。< anonymous> (/user_code/node_modules/googleapis/node_modules/request/request.js:1085:12)
IncomingMessage.g(events.js:292:16)
at emitNone(events.js:91: 20)
D githubAutoDeployer [CODE] 2017-12-30 19:19:37.365
功能执行耗时2319毫秒,结束状态码:500
更新在堆栈跟踪中提及
google-auth-library
我认为我的凭据可能有问题。但是从gcloud auth list
的输出显示正常:
Credentialed Accounts
ACTIVE ACTIVE ACCOUNT
* [MY_ID] @ gmail.com
更新也许稍微不合常规的是,我在
config.json
path:, >。但是,我的index.js
直接位于我的仓库顶部,因此没有指定的路径。
更新 这个是来自Google Cloud Functions的错误被
githubAutoDeployer
传递(不幸的是,上游服务器的源代码显然不可用):
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 );
}
解决方案我是规格ifying
location:us-central
而不是us-central1
(which 支持Google Cloud Functions )在我的config.json
中。
我通过向 Google Cloud Functions API (获得服务帐户和访问令牌等)。在此级别,API返回一个明确的错误指示:
fieldViolations:[
{
字段:region,
description:不支持region us-central。
$ b显然不幸的是,当githubAutoDeployer
尝试相同的呼叫时,I have installed the GitHub auto-deployer for Google Cloud Functions, but when I now push my function into my GitHub repository, I receive an abstract error message
"The request has errors"
with the following rather non-descript details. What could specifically be going wrong here?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
UPDATE The mentioning of
google-auth-library
in the stack trace made me think that something may be wrong with my credentials. But the output fromgcloud auth list
appears alright:Credentialed Accounts ACTIVE ACCOUNT * [MY_ID]@gmail.com
UPDATE What is perhaps slightly unconventional is that I have
"path":"",
in myconfig.json
. But then myindex.js
resides directly at the top of my repository, so there is no path to specify.UPDATE This is where the error from Google Cloud Functions is passed on by
githubAutoDeployer
(unfortunately source code for the upstream server is apparently not available):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); }
解决方案The trouble was that I was specifying
"location" : "us-central"
instead ofus-central1
(which supports Google Cloud Functions) in myconfig.json
.I found out by sending a raw POST request to the Google Cloud Functions API (after obtaining a service account and access token, etc.). At this level the API returns a clear error indication:
"fieldViolations": [ { "field": "region", "description": "region us-central is not supported." } ]
Apparently and unfortunately this does not enter any of the log files when
githubAutoDeployer
attempts the same call.这篇关于Google Cloud Functions GitHub自动部署者说:请求有错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!