7

I reinstalled multiple times NPM and Node on my pc.

(npm version 7.4.3)

(node version v15.7.0)

I followed the procedure for configuring the Firebase CLI with:

npm install -g firebase-tools

and firebase init and firebase deploy and the configuration seems to work fine.

The problem I'm facing happens when I open the index.js file and I uncomment the stock helloWorld function which looks like this:

exports.helloWorld = functions.https.onRequest((request, response) => {
functions.logger.info("Hello logs!", {structuredData: true});
response.send("Hello from Firebase!");
});

I run firebase deploy and I receive this error

functions[helloWorld(us-central1)]: Deployment error.
Build failed: Build error details not available. Please check the logs at https://console.    {urlStuff}


Functions deploy had errors with the following functions:
helloWorld


 To try redeploying those functions, run:
firebase deploy --only "functions:helloWorld"


 To continue deploying other features (such as database), run:
firebase deploy --except functions

 Error: Functions did not deploy properly.

I honestly don't know what to do now. I tried multiple times to re install node and npm and re doing the Firebase CLI procedure but nothing seems to solve this problem, I still receive this Error when deploying.

The log error I receive is this :

textPayload: "ERROR: error fetching storage source: generic::unknown: retry budget exhausted (3 attempts): fetching gcs source: unpacking source from gcs: source fetch container exited with non-zero status: 1"
StackGU
  • 868
  • 9
  • 22
  • have you checked error details in the firebase function logs? – Muthu Thavamani Jan 29 '21 at 13:26
  • Yes, despite my inability to find any useful information in it. I added it to the text of the question now :) – StackGU Jan 29 '21 at 13:35
  • 1
    don't have any clue about this error. however got some useful ref - https://stackoverflow.com/questions/64437656/gcp-cloud-function-error-fetching-storage-source-during-build-deploy – Muthu Thavamani Jan 29 '21 at 13:40
  • 1
    Bro you saved me, in the question you linked it's written there's a mismatch between the 2 versions of NodeJs, firebase runs with version 12 while I've installed version 15 – StackGU Jan 29 '21 at 13:59
  • 1
    Glad, you made it! – Muthu Thavamani Jan 29 '21 at 14:03
  • I was getting this error for 2 weeks, I uninstalled every package on my computer, reinstalled everything. Finally I just made a new firebase project and everything worked fine... it seems something went wrong on Google's end, by random chance, when I created our project, and no function deployments would ever work. New project and no other changes (except selecting the new project in CLI) and deploy worked fine and all functions built just fine. SUCH a pain and waste of 2 weeks, hopefully this saves others the headache! – Albert Renshaw Apr 05 '23 at 20:04

5 Answers5

10

As suggested by this link provided by @Muthu Thavamani :

GCP Cloud Function - ERROR fetching storage source during build/deploy

Firebase CLI uses NodeJS version 12 while on my device I had version 15 installed.

Just use this guide to downgrade your version of NodeJS and everything works fine.

StackGU
  • 868
  • 9
  • 22
3

For me, it was because I was using an older version of Firebase CLI.

So I ran the upgrade command as suggested, and it worked.

sudo npm i -g firebase-tools

(My Node version is v15.6.0)

WSBT
  • 33,033
  • 18
  • 128
  • 133
0

I had a similar problem and wasn't solved by changing node version. What I had to do is actually enter Container Repos and delete both worker & cache images. Then I got it running (using node v12.22.1 and npm v6.14.12).

pp__b
  • 123
  • 7
0

It's much easier to find and fix issue by examining the actual logs by using this command to open the log

firebase functions:log

The specific issue will be visible there. I sometimes had error as simple as a missing packages in package.json

I wish they could show better info on the errors directly. but at least we can find them here.

Abraham
  • 12,140
  • 4
  • 56
  • 92
0

I was getting this error for 2 weeks, I uninstalled every package on my computer, reinstalled everything. Finally I just made a new firebase project and everything worked fine... it seems something went wrong on Google's end, by random chance, when I created our project, and no function deployments would ever work. New project and no other changes (except selecting the new project in CLI) and deploy worked fine and all functions built just fine. SUCH a pain and waste of 2 weeks, hopefully this saves others the headache!

Albert Renshaw
  • 17,282
  • 18
  • 107
  • 195