使用Google Cloud Build部署Firebase功能

时间:2019-03-31 04:18:19

标签: firebase google-cloud-functions firebase-cli google-cloud-build

我正在尝试使用Google Cloud Build部署我的Firebase功能,但是遇到一个奇怪的错误。我已经附上了Cloud Build的日志。

我已经安装了社区Firebase docker映像。 https://github.com/GoogleCloudPlatform/cloud-builders-community/tree/master/firebase

我有一个cloudbuild.yaml文件,该文件仅手动运行一些部署步骤(安装,棉绒,构建),然后运行firebase deploy --only functions

cloudbuild.yaml

steps:
# Install
- name: 'gcr.io/cloud-builders/npm'
  args: ['install']
# Install
- name: 'gcr.io/cloud-builders/npm'
  args: ['run', 'lint']
# Install
- name: 'gcr.io/cloud-builders/npm'
  args: ['run', 'build']
# Deploy
- name: 'gcr.io/$PROJECT_ID/firebase'
  args: ['deploy', '--only', 'functions', '-P', 'development', '--debug']

日志

Step #3: i deploying functions
Step #3: [2019-03-31T04:02:35.891Z] > [functions] package.json contents: {
Step #3: "name": "functions",
Step #3: "scripts": {
Step #3: "lint": "tslint --project tsconfig.json",
Step #3: "build": "tsc",
Step #3: "serve": "npm run build && firebase serve --only functions",
Step #3: "shell": "npm run build && firebase functions:shell",
Step #3: "start": "npm run shell",
Step #3: "deploy": "firebase deploy --only functions",
Step #3: "logs": "firebase functions:log"
Step #3: },
Step #3: "main": "lib/index.js",
Step #3: "dependencies": {
Step #3: "firebase-admin": "~7.0.0",
Step #3: "firebase-functions": "^2.2.0",
Step #3: "geofirestore": "^3.2.3"
Step #3: },
Step #3: "devDependencies": {
Step #3: "tslint": "^5.12.0",
Step #3: "typescript": "^3.2.2"
Step #3: },
Step #3: "private": true
Step #3: }
Step #3: i functions: ensuring necessary APIs are enabled...
Step #3: [2019-03-31T04:02:35.893Z] >>> HTTP REQUEST GET https://servicemanagement.googleapis.com/v1/services/cloudfunctions.googleapis.com/projectSettings/my-project?view=CONSUMER_VIEW 
Step #3: 
Step #3: [2019-03-31T04:02:35.894Z] >>> HTTP REQUEST GET https://servicemanagement.googleapis.com/v1/services/runtimeconfig.googleapis.com/projectSettings/my-project?view=CONSUMER_VIEW 
Step #3: 
Step #3: [2019-03-31T04:02:36.190Z] <<< HTTP RESPONSE 404 vary=X-Origin, Referer, Origin,Accept-Encoding, content-type=application/json; charset=UTF-8, date=Sun, 31 Mar 2019 04:02:36 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, accept-ranges=none, transfer-encoding=chunked
Step #3: [2019-03-31T04:02:36.191Z] <<< HTTP RESPONSE BODY code=404, message=Method not found., status=NOT_FOUND
Step #3: 
Step #3: Error: HTTP Error: 404, Method not found.
Step #3: [2019-03-31T04:02:36.194Z] Error Context: {
Step #3: "body": {
Step #3: "error": {
Step #3: "code": 404,
Step #3: "message": "Method not found.",
Step #3: "status": "NOT_FOUND"
Step #3: }
Step #3: },
Step #3: "response": {
Step #3: "statusCode": 404,
Step #3: "body": {
Step #3: "error": {
Step #3: "code": 404,
Step #3: "message": "Method not found.",
Step #3: "status": "NOT_FOUND"
Step #3: }
Step #3: },
Step #3: "headers": {
Step #3: "vary": "X-Origin, Referer, Origin,Accept-Encoding",
Step #3: "content-type": "application/json; charset=UTF-8",
Step #3: "date": "Sun, 31 Mar 2019 04:02:36 GMT",
Step #3: "server": "ESF",
Step #3: "cache-control": "private",
Step #3: "x-xss-protection": "1; mode=block",
Step #3: "x-frame-options": "SAMEORIGIN",
Step #3: "x-content-type-options": "nosniff",
Step #3: "accept-ranges": "none",
Step #3: "transfer-encoding": "chunked"
Step #3: },
Step #3: "request": {
Step #3: "uri": {
Step #3: "protocol": "https:",
Step #3: "slashes": true,
Step #3: "auth": null,
Step #3: "host": "servicemanagement.googleapis.com",
Step #3: "port": 443,
Step #3: "hostname": "servicemanagement.googleapis.com",
Step #3: "hash": null,
Step #3: "search": "?view=CONSUMER_VIEW",
Step #3: "query": "view=CONSUMER_VIEW",
Step #3: "pathname": "/v1/services/runtimeconfig.googleapis.com/projectSettings/my-project",
Step #3: "path": "/v1/services/runtimeconfig.googleapis.com/projectSettings/my-project?view=CONSUMER_VIEW",
Step #3: "href": "https://servicemanagement.googleapis.com/v1/services/runtimeconfig.googleapis.com/projectSettings/my-project?view=CONSUMER_VIEW"
Step #3: },
Step #3: "method": "GET"
Step #3: }
Step #3: }
Step #3: }
Step #3: [2019-03-31T04:02:36.229Z] <<< HTTP RESPONSE 404 vary=X-Origin, Referer, Origin,Accept-Encoding, content-type=application/json; charset=UTF-8, date=Sun, 31 Mar 2019 04:02:36 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, accept-ranges=none, transfer-encoding=chunked
Step #3: [2019-03-31T04:02:36.230Z] <<< HTTP RESPONSE BODY code=404, message=Method not found., status=NOT_FOUND
Finished Step #3
ERROR
ERROR: build step 3 "gcr.io/my-project/firebase" failed: exit status 1

还值得注意的是,cloudbuild服务帐户具有Firebase Admin权限。太奇怪了,我可以在Firebase托管中使用Cloud Build,但没有问题,但是在部署功能时遇到404错误。

0 个答案:

没有答案