Firebase-tools: Failed to deploy functions with ADC

Created on 25 Jul 2019  ·  7Comments  ·  Source: firebase/firebase-tools

[REQUIRED] Environment info

firebase-tools:
7.2.0


Platform:
macOS

[REQUIRED] Test case

Look steps below.

[REQUIRED] Steps to reproduce

  1. install firebase-tools v7.2.0
  2. set GOOGLE_APPLICATION_CREDENTIALS to use ADC
  3. deploy functions

    1. firebase deploy --only functions

[REQUIRED] Expected behavior

Deploy successfully.

[REQUIRED] Actual behavior

It shows Error: HTTP Error: 404, Method not found. as an error message.
This error does not occur in v7.1.0, only in v7.2.0.

Most helpful comment

👍 glad we got you fixed. Thanks again for the report!

All 7 comments

This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.

Can you please run the command with --debug and include the full output here?

@mbleigh
here it is.

[2019-07-25T08:16:40.940Z] ----------------------------------------------------------------------
[2019-07-25T08:16:40.944Z] Command:       /usr/local/bin/node /workspace/functions/node_modules/.bin/firebase deploy --debug --only functions
[2019-07-25T08:16:40.945Z] CLI Version:   7.2.0
[2019-07-25T08:16:40.945Z] Platform:      linux
[2019-07-25T08:16:40.946Z] Node Version:  v10.16.0
[2019-07-25T08:16:40.946Z] Time:          Thu Jul 25 2019 08:16:40 GMT+0000 (Coordinated Universal Time)
[2019-07-25T08:16:40.947Z] ----------------------------------------------------------------------

[2019-07-25T08:16:40.958Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2019-07-25T08:16:40.958Z] > attempting to authenticate via app default credentials
[2019-07-25T08:16:41.068Z] ya29.c.XXXXX
[2019-07-25T08:16:41.069Z] > retrieved access token via default credentials
[2019-07-25T08:16:41.071Z] [iam] checking project nomos-sms for permissions ["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]
[2019-07-25T08:16:41.073Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/nomos-sms:testIamPermissions
 permissions=[cloudfunctions.functions.create, cloudfunctions.functions.delete, cloudfunctions.functions.get, cloudfunctions.functions.list, cloudfunctions.functions.update, cloudfunctions.operations.get, firebase.projects.get]
[2019-07-25T08:16:41.176Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 25 Jul 2019 08:16:41 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, server-timing=gfet4t7; dur=53, accept-ranges=none, transfer-encoding=chunked
⚠  functions: package.json indicates an outdated version of firebase-functions.
 Please upgrade using npm install --save firebase-functions@latest in your functions directory.

=== Deploying to 'nomos-sms'...

i  deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run build

> functions@ build /workspace/functions
> tsc

✔  functions: Finished running predeploy script.
[2019-07-25T08:16:57.195Z] > [functions] package.json contents: {
  "name": "functions",
  "engines": {
    "node": "10"
  },
  "scripts": {
    "lint": "xo --ignore '**/*.js' --reporter compact",
    "lint-fix": "xo --fix --ignore '**/*.js'",
    "lint-ci": "xo --ignore '**/*.js' --reporter junit",
    "build": "tsc",
    "watch": "tsc --watch",
    "copy-views": "cp -r src/views lib",
    "test": "jest",
    "test:ci": "cross-env JEST_JUNIT_INCLUDE_CONSOLE_OUTPUT=true jest --maxWorkers=4 --ci --reporters='jest-junit'",
    "test:watch": "cross-env TERM=dumb jest --watch",
    "serve": "npm run build && firebase serve --only functions",
    "shell": "npm run build && firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "main": "lib/index.js",
  "xo": {
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
      "warnOnUnsupportedTypeScriptVersion": false,
      "project": "./tsconfig.json",
      "tsconfigRootDir": "."
    },
    "envs": [
      "jest",
      "node"
    ],
    "plugins": [
      "jest"
    ],
    "extends": [
      "xo-typescript"
    ],
    "settings": {
      "import/resolver": {
        "alias": {
          "map": [
            [
              "~",
              "./src"
            ]
          ],
          "extensions": [
            ".ts",
            ".d.ts"
          ]
        }
      },
      "import/ignore": [
        "node_modules",
        "types"
      ]
    },
    "rules": {
      "camelcase": [
        "error",
        {
          "properties": "never"
        }
      ],
      "radix": [
        "error",
        "as-needed"
      ],
      "eslint-comments/no-unused-disable": "off",
      "indent": "off",
      "@typescript-eslint/indent": "off",
      "@typescript-eslint/no-require-imports": "off",
     "@typescript-eslint/member-delimiter-style": [
        "error",
        {
          "multiline": {
            "delimiter": "none",
            "requireLast": false
          }
        }
      ],
      "@typescript-eslint/semi": [
        "error",
        "never",
        {
          "beforeStatementContinuationChars": "always"
        }
      ],
      "ava/no-import-test-files": [
        "error",
        {
          "files": [
            "src/test/**/*.spec.ts"
          ]
        }
      ]
    },
    "space": 2,
    "semicolon": false,
    "prettier": true,
    "extensions": [
      "ts"
    ]
  },
  "dependencies": {
    "@google-cloud/debug-agent": "^4.0.1",
    "@google-cloud/pubsub": "^0.30.1",
    "@types/jest-diff": "20.0.1",
    "axios": "^0.19.0",
    "firebase-admin": "8.3.0",
    "firebase-functions": "3.1.0",
    "pug": "2.0.4",
    "upper-case-first": "^1.1.2"
  },
  "devDependencies": {
    "@babel/core": "^7.5.5",
    "@types/jest": "^24.0.15",
    "@types/pug": "2.0.4",
    "@typescript-eslint/eslint-plugin": "1.13.0",
    "@typescript-eslint/parser": "1.13.0",
    "babel-core": "^7.0.0-0",
    "babel-jest": "24.8.0",
    "cross-env": "^5.2.0",
    "eslint-config-xo-typescript": "0.15.0",
    "eslint-import-resolver-alias": "^1.1.2",
    "eslint-plugin-jest": "^22.13.0",
    "eslint-plugin-unicorn": "9.1.1",
    "firebase-tools": "^7.2.0",
    "husky": "^3.0.1",
    "jest": "24.8.0",
    "jest-junit": "^7.0.0",
    "lint-staged": "9.2.0",
    "ts-jest": "^24.0.2",
    "typescript": "^3.5.3",
    "typescript-eslint-language-service": "1.1.2",
    "xo": "^0.24.0"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.ts": [
      "xo --fix",
      "git add"
    ]
  },
  "private": true
}
i  functions: ensuring necessary APIs are enabled...
[2019-07-25T08:16:57.199Z] >>> HTTP REQUEST GET https://servicemanagement.googleapis.com/v1/services/cloudfunctions.googleapis.com/projectSettings/xxx-yyy?view=CONSUMER_VIEW

[2019-07-25T08:16:57.200Z] >>> HTTP REQUEST GET https://servicemanagement.googleapis.com/v1/services/runtimeconfig.googleapis.com/projectSettings/xxx-yyy?view=CONSUMER_VIEW

[2019-07-25T08:16:57.454Z] <<< HTTP RESPONSE 404 vary=X-Origin, Referer, Origin,Accept-Encoding, content-type=application/json; charset=UTF-8, date=Thu, 25 Jul 2019 08:16:57 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, accept-ranges=none, transfer-encoding=chunked
[2019-07-25T08:16:57.455Z] <<< HTTP RESPONSE BODY code=404, message=Method not found., status=NOT_FOUND

Error: HTTP Error: 404, Method not found.
[2019-07-25T08:16:57.470Z] Error Context: {
  "body": {
    "error": {
      "code": 404,
      "message": "Method not found.",
      "status": "NOT_FOUND"
    }
  },
  "response": {
    "statusCode": 404,
    "body": {
      "error": {
        "code": 404,
        "message": "Method not found.",
        "status": "NOT_FOUND"
      }
    },
    "headers": {
      "vary": "X-Origin, Referer, Origin,Accept-Encoding",
      "content-type": "application/json; charset=UTF-8",
      "date": "Thu, 25 Jul 2019 08:16:57 GMT",
      "server": "ESF",
      "cache-control": "private",
      "x-xss-protection": "0",
      "x-frame-options": "SAMEORIGIN",
      "x-content-type-options": "nosniff",
      "accept-ranges": "none",
      "transfer-encoding": "chunked"
    },
    "request": {
      "uri": {
        "protocol": "https:",
        "slashes": true,
        "auth": null,
        "host": "servicemanagement.googleapis.com",
        "port": 443,
        "hostname": "servicemanagement.googleapis.com",
        "hash": null,
        "search": "?view=CONSUMER_VIEW",
        "pathname": "/v1/services/runtimeconfig.googleapis.com/projectSettings/xxx-yyy",
        "path": "/v1/services/runtimeconfig.googleapis.com/projectSettings/xxx-yyy?view=CONSUMER_VIEW",
        "href": "https://servicemanagement.googleapis.com/v1/services/runtimeconfig.googleapis.com/projectSettings/xxx-yyy?view=CONSUMER_VIEW"
      },
      "method": "GET"
    }
  }
}
[2019-07-25T08:16:57.483Z] <<< HTTP RESPONSE 404 vary=X-Origin, Referer, Origin,Accept-Encoding, content-type=application/json; charset=UTF-8, date=Thu, 25 Jul 2019 08:16:57 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, accept-ranges=none, transfer-encoding=chunked
[2019-07-25T08:16:57.483Z] <<< HTTP RESPONSE BODY code=404, message=Method not found., status=NOT_FOUND

I masked some credential information.

Thanks for reporting this @iwata! It looks like this may be due to a change from 7.1.0 to 7.2.0 in the API we use to check if APIs are enabled: in 7.1.0, we used https://serviceusage.googleapis.com, and in 7.2.0 we are using https://servicemanagement.googleapis.com.

@joehan
Could you fix this soon?

It worked well if I tried it in 7.2.1. Thank you for fixing it!

👍 glad we got you fixed. Thanks again for the report!

Was this page helpful?
0 / 5 - 0 ratings