谷歌云功能GitHub auto-deployer说:请求有错误

时间:2017-12-30 19:45:10

标签: github google-cloud-functions webhooks

我已经为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直接位于我的存储库的顶部,因此没有要指定的路径。

更新 ThisgithubAutoDeployer传递来自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);
  }

1 个答案:

答案 0 :(得分:0)

问题是我在"location" : "us-central"中指定了us-central1而不是config.jsonsupports Google Cloud Functions}。

我通过向Google Cloud Functions API发送原始POST请求(在获得服务帐户和访问令牌等之后)发现了这一点。在此级别,API会返回明确的错误指示:

"fieldViolations": [
  {
    "field": "region",
    "description": "region us-central is not supported."
  }
]

显然,当githubAutoDeployer尝试同一次呼叫时,这不会输入任何日志文件。