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?
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?
7
Answers
Make sure that firebase-tools is actually updated. Try
firebase --version
and see if it isv11.18.0
.I had firebase installed with
pnpm
globally, sonpm update
did not actually update the correct package.I had same error in windows 10.
firebase deploy --only functions
v11.18.0 has fixed the error.
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:
cd E:somefilelocationtocloud_functions
then you can dofirebase init
andfirebase deploy
Furthermore, while you’re having the terminal opened, you can check
firebase --version
to 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!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 https://firebase.tools | upgrade=true bash
Verify it using
firebase --version
, mine is at11.22.0
now.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.