2

I get the error: "Failed to retrieve function source code" when I try and deploy a function.

enter image description here

This is all from the command line. I am using node 6.11.5 (but in the firebase-admin package.json file in the nodes folder it is says node 6.9.1 is used to download that). I am using [email protected] and [email protected].

This is the code in my index.js file that I am trying to deploy:

const functions = require('firebase-functions');
 exports.helloWorld = functions.https.onRequest((request, response) => {
  response.send("Hello from Firebase!");
 });

I have also tried to deploy many different things.

Two interesting things: - I used to be able to deploy any function without problem. This changed about a month ago and now every function I try gets this error. I can't remember making any change that would be related to this. - Also I can deploy functions from my computer (with the exact same set up and firebase versions) to other projects in the same google account and different google accounts without any problem.

Thanks

4
  • 1
    If this problem persists, run the command with the --debug flag, capture the output, and send that to Firebase support. firebase.google.com/support/contact/troubleshooting Commented Jan 26, 2018 at 17:11
  • Cheers doug, I have done this. The debug flag wasn't that helpful for me. It just fails on a http request whereas a successful one passes that request. I have no idea what that request does. Hopefully they will have an answer here. Commented Jan 26, 2018 at 17:32
  • Right, they can look into it. There's probably nothing anyone here on SO can say about the problem since there's no helpful error message. Commented Jan 26, 2018 at 17:36
  • Did you get a solution for this. Yesterday everything was deploying correctly today it says 'cannot retrieve function source code'. I have tried deleting the functions folder and initialising it again but nothing still
    – Taio
    Commented Sep 2, 2020 at 9:08

1 Answer 1

7

I think you should check your billing settings in google cloud. I got the same problem and after updating billing information then redeploy the function, the error is gone.

5
  • 1
    Same here, the billing issue could be a reason for the deployment error. There was an issue with the payment method. After I updated the payment method. I can successfully deploy the code.
    – William Wu
    Commented Sep 4, 2020 at 16:28
  • Can a firebase rep clarify how this answer is a thing kindly. @Doug Stevenson. Can firebase prevent deploying a new function due to blling?
    – Taio
    Commented Sep 7, 2020 at 8:48
  • Okay this answer just worked. I had been stuck here for a week wondering what I was doing wrong. Uninstalled and reinstalled node, deployed the default cloud functions code,,, still nothing. I was now about to clean install my OS and install everything afresh from my editor thinking I messed up somewhere I could not place. A firebase rep needs to explain this, honestly
    – Taio
    Commented Sep 7, 2020 at 9:30
  • I think we can only deploy cloud function with pay as you go plan, even if we are targeting nodejs 8. Am I right? Commented Sep 25, 2020 at 18:16
  • Actually I have "pay as you go" plan and the issue is still there, not sure what's going on :c Commented Oct 10, 2020 at 18:51

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.