2
votes

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

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 - Doug Stevenson
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. - Lewis Black
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. - Doug Stevenson
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

1 Answers

6
votes

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.