Unexpected Error while deploying using "firebase deploy --only functions" in firebase-tools@11.8.0 (latest version) (Could not find functions.yaml. Must use http discovery).
See original GitHub issue[REQUIRED] Environment info
firebase-tools: 11.8.0 (latest release)
Platform: : macOS
[REQUIRED] Test case
If I make a function on the index.js file, and then I try to deploy using:
firebase deploy --only functions:nameOfYourFunction
I get an Unexpected Error at the end.
[REQUIRED] Steps to reproduce
Using npm or whatever package manager you prefer, run these on your terminal,
npm install -g firebase-tools firebase login firebase init functions
Now under the functions folder, make sure you have installed node modules using npm install
,
and finally you create a basic function you like on index.js after you are done importing stuffs, for example:
const functions = require(‘firebase-functions’); const admin = require(‘firebase-admin’); admin.initializeApp();
exports.yourFunctionName = functions.https.onRequest(async(req,res)=>{ functions.logger.log(res.body); //just for an example. })
Now when you try to do:
firebase deploy --only functions:yourFunctionName
You’ll see this error message in the end:
[debug] [2022-09-05T11:21:08.962Z] Building nodejs source [debug] [2022-09-05T11:21:08.963Z] Could not find functions.yaml. Must use http discovery [debug] [2022-09-05T11:21:08.972Z] Error: spawn ./node_modules/.bin/firebase-functions ENOENT at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19) at onErrorNT (node:internal/child_process:476:16) at processTicksAndRejections (node:internal/process/task_queues:83:21) [error] [error] Error: An unexpected error has occurred. [debug] [2022-09-05T11:21:09.063Z] Serving at port 9005
[REQUIRED] Expected behavior
Expected behaviour is that the function gets deployed successfully without any error.
[REQUIRED] Actual behavior
Actual behaviour is that function normally get’s deployed successfully and just after this update, this issue came into play.
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:25 (5 by maintainers)
I have the same problem with my Nuxt app. To avoid it, I delete the node_models folder in the output directory and reinstall it.
After that everything works normally.
Node v16.18.1 Firebase v11.16.1 Ubuntu 22.04
I could fix this issue just by downgrading the version of firebase tools to v10.0.0 using:
npm install -g firebase-tools@10.0.0