question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:open
  • Created a year ago
  • Reactions:2
  • Comments:25 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
howbizarrecommented, Dec 6, 2022

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.

$ NITRO_PRESET=firebase npm run build && cd .output/server && rm -rf node_modules && npm i && cd ../../ && firebase login && firebase deploy

After that everything works normally.

Node v16.18.1 Firebase v11.16.1 Ubuntu 22.04

2reactions
rahuld600commented, Sep 5, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting an error when deploying firebase with node.js
Port 9005 is already in use Error: An unexpected error has occurred. Logs say this: Building nodejs source Could not find functions.yaml. Must...
Read more >
Manage functions | Cloud Functions for Firebase - Google
To solve this, deploy functions in groups of 10 or fewer. See the Firebase CLI reference for the full list of available commands....
Read more >
Super simple start to Firebase functions - Kent C. Dodds
Step 13: Auto-deploy Firebase Cloud Functions with GitHub Actions · It's using npx so we don't have to worry about installing things globally ......
Read more >
When Your Firebase Cloud Functions Don't Want to Deploy ...
For the last eight months that my project/company has lived, I have never experienced an issue deploying my Cloud Functions, until today.
Read more >
404 Not Found firebasedeploy - Atlassian Community
I am trying to use firebasedeploy pipe for deployment and I am getting the ... The root cause can also be not in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found