0

When I try to deploy my firebase functions I get the following error using the --debug option:

    [2023-04-27T14:33:31.762Z] > [functions] package.json contents: {
  "name": "functions",
  "scripts": {
    "lint": "eslint --ext .js,.ts .",
    "build": "tsc",
    "watch": "tsc --watch",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log",
    "emulate-functions": "~/projects/scripts/kill-emulator.sh | tsc -w | firebase emulators:start --only functions --inspect-functions",
    "emulate-debug": "~/projects/scripts/kill-emulator.sh | tsc -w | firebase emulators:start --inspect-functions",
    "emulate": "kill-emulator.sh | tsc -w | firebase emulators:start"
  },
  "comments": {
    "emulate-functions": "Can be used to debug HTTP callable cloud functions. To debug cloud triggered function firestore emulator must be running. Because of debugger support, functions will not be running in parallel",
    "emulate-debug": "Runs all emulators with the functions debugging enabled",
    "emulate": "Runs all emulator with the fungtions debugger disabled. Give the best emulation, but functions cannot be debugged",
    "note1": "npm run emulate -- --import=seeds/latest --export-on-exit=seeds/latest will run the emulator with persistant data. (seeds folder must exist, before you start)",
    "note2": "Emulator is best run from the functions folder. If it is run from the docavea folder, functions code does not reload correctly"
  },
  "main": "lib/src/index.js",
  "dependencies": {
    "@sendgrid/mail": "^7.7.0",
    "api2pdf": "^1.1.1",
    "axios": "^0.19.2",
    "firebase-admin": "^11.7.0",
    "firebase-functions": "^4.3.1",
    "firebase-tools": "^11.28.0",
    "googleapis": "^111.0.0",
    "lodash": "^4.17.21",
    "mailchimp-api-v3": "^1.13.1",
    "md5": "^2.2.1",
    "onedrive-api": "^1.0.4",
    "pdf-lib": "^1.17.1",
    "php-serialize": "^3.0.1",
    "source-map-support": "^0.5.21"
  },
  "engines": {
    "node": "16"
  },
  "devDependencies": {
    "@types/lodash": "^4.14.191",
    "@types/node": "^16",
    "@types/php-serialize": "^3.0.0",
    "@typescript-eslint/eslint-plugin": "^5.53.0",
    "@typescript-eslint/parser": "^5.53.0",
    "eslint": "^8.39.0",
    "eslint-config-google": "^0.14.0",
    "eslint-plugin-import": "^2.27.5",
    "typescript": "^4.9.5"
  },
  "private": true
}
[2023-04-27T14:33:31.763Z] Building nodejs source
[2023-04-27T14:33:31.764Z] Could not find functions.yaml. Must use http discovery
[2023-04-27T14:33:32.064Z] Serving at port 9005

[2023-04-27T14:33:42.426Z] Got response from /__/functions.yaml Failed to generate manifest from function source: TypeError: Cannot read properties of undefined (reading 'storage')
[2023-04-27T14:33:42.428Z] Failed to parse functions.yamlincomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line at line 1, column 60:
     ...  from function source: TypeError: Cannot read properties of unde ... 
                                         ^ {"name":"YAMLException","reason":"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line","mark":{"name":null,"buffer":"Failed to generate manifest from function source: TypeError: Cannot read properties of undefined (reading 'storage')\n\u0000","position":59,"line":0,"column":59},"message":"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line at line 1, column 60:\n     ...  from function source: TypeError: Cannot read properties of unde ... \n                                         ^"}
[2023-04-27T14:33:42.446Z] shutdown requested via /__/quitquitquit


Error: Failed to load function definition from source: Failed to generate manifest from function source: TypeError: Cannot read properties of undefined (reading 'storage')

I don't understand this part of the log "Could not find functions.yaml. Must use http discovery". I have read this answer Firebase Deployment failure - Could not find functions.yaml. Must use http discovery 1. and 2. are setup correctly (I never had problems deploying before) and I have tried to rerun firebase init without any improvement. I have also tried to delete all function on the server.

What is functions.yaml?

  1. Am I supposed to have one? (I cannot find a file of that name on my disk)
  2. Where should it be located?
  3. What should I put in the file?
  4. Where can I find documentation on functions.yaml?
Jørgen Rasmussen
  • 1,143
  • 14
  • 31
  • If you're interested in checking the functions source to see if there's any causes of this error, please post some function that reproduces this error. – Chris Apr 28 '23 at 20:33

1 Answers1

1

functions.yaml is a firebase-generated file that is used to determine what kind of functions exist in the project's source code. Developers should not write this file and it's not intended to be modified by developers. This explains the missing documentation on the file.

The log you're seeing is from here: https://github.com/firebase/firebase-tools/blob/06b8bad39e8f92f9f348a751076fc016b6583a79/src/deploy/functions/runtimes/discovery/index.ts#L47

The error you have seems to be caused by a malformed functions.yaml either due to a bug in the deployment operation or perhaps in the project's functions source.

Possibly-related bug: https://github.com/firebase/firebase-tools/issues/5673

Chris
  • 846
  • 6
  • 16