I am trying to deploy the firebase functions and getting the error:
Error: Failed to fetch Run service undefined`
I've already tried to update firebase-tools, but it did not help. Could you please help to resolve it?
17 Answers
I had same error in windows 10.firebase deploy --only functions
v11.18.0 has fixed the error.
npm install -g firebase-tools --force
npm audit fix 4 Make sure that firebase-tools is actually updated. Try firebase --version and see if it is v11.18.0.
I had firebase installed with pnpm globally, so npm update did not actually update the correct package.
As others have pointed out, this is an issue with an older version.
Manual workaround: before deployment, go to Firebase admin console, and delete all existing cloud functions there. If the console is clean, the deploy command will work.
Proper solution: Upgrade firebase cli version.
On macOS, I noticed no matter how many times I run npm install it never actually updated.
This command finally updated it for me:
curl -sL | upgrade=true bash
Verify it using firebase --version, mine is at 11.22.0 now.
After a day of try and error. I noticed that no matter what I do the firebase --version never updates. v11.0.1 or whatever it is in your case.
I tried a simple workaround on this problem as following:
- Downloaded the firebase standalone binary from their official webpage
- [optional] copied it to C:\firebase (For easy access next time)
- Run it from there, it will open up a terminal, you can now
cd E:\some\file\location\to\cloud_functionsthen you can dofirebase initandfirebase deployFurthermore, while you're having the terminal opened, you can checkfirebase --versionto see that this terminal does have the latest version of the firebase-tools unlike the global windows cmd. At least this solved the problem for me, I wanted to share it in case it might help someone!
also check node version. I had node 16 selected and it was too new for firebase-functions 3.20.0 and npm 8.19.3.
Selecting with nvm use 14 did the trick here.
Another quick workaround will be to deploy the function through the google cloud console directly.
Installing the latest version of the firebase-functions package and changing node from 10 to 14 in functions/package.json did it for me. Deleting package.json might also be wise.
2