firebase-tools: Function deployment fails when running on Node 15.8.0

[REQUIRED] Environment info

firebase-tools: 9.3.0 Node Version: 15.8.0 Platform: Linux 5.4.89-1-MANJARO

[REQUIRED] Test case

Deploy the function generated initially when you run firebase init and select functions.

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

[REQUIRED] Steps to reproduce

Deploy the function above:

$ firebase deploy --only "functions:helloWorld"

[REQUIRED] Expected behavior

Expected behavior is to deploy the function(s) without any errors.

[REQUIRED] Actual behavior

Deployments fails with the following output message in local terminal:

$ firebase deploy --only "functions:helloWorld"

=== Deploying to 'test-functions-d4276'...

i  deploying functions
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
✔  functions: required API cloudfunctions.googleapis.com is enabled
⚠  functions: missing required API cloudbuild.googleapis.com. Enabling now...
✔  functions: required API cloudbuild.googleapis.com is enabled
i  functions: preparing functions directory for uploading...
i  functions: packaged functions (41.36 KB) for uploading
✔  functions: functions folder uploaded successfully
i  functions: uploading functions in project: helloWorld(us-central1)
i  functions: creating Node.js 12 function helloWorld(us-central1)...
⚠  functions[helloWorld(us-central1)]: Deployment error.
Build failed: Build error details not available. Please check the logs at https://console.cloud.google.com/logs/...


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.

Having trouble? Try firebase [command] --help

Cloud console had the following output in log explorer:

{
	"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",
	"insertId": "07530e91-3ce1-44c5-88a7-b8025758115c-27",
	"resource": {
		"type": "build",
		"labels": {
			"project_id": "test-functions-d4276",
			"build_id": "07530e91-3ce1-44c5-88a7-b8025758115c",
			"build_trigger_id": ""
		}
	},
	"timestamp": "2021-02-08T22:48:26.709353507Z",
	"severity": "INFO",
	"labels": {
		"build_step": "MAIN"
	},
	"logName": "projects/test-functions-d4276/logs/cloudbuild",
	"receiveTimestamp": "2021-02-08T22:48:26.906497807Z"
}

Workaround

I switched to Node version 14.x.x and everything worked fine. This may be a duplicate of #3108. The SO link they provided also has more details so it might be worth looking into. In #3108 they seem to have trouble deploying with node versions aside from 15.x.x. They mention that deploy requires keyboard input in GCP; in my logs this does show up but seems selects an input automatically anyway, the selected input being [N]one. I am listing the summary for this particular log message below. Note, this happens before the error message I attached farther up the document.

{
  "textPayload": "replace /workspace/.runtimeconfig.json? [y]es, [n]o, [A]ll, [N]one, [r]ename:  NULL",
  "insertId": "07530e91-3ce1-44c5-88a7-b8025758115c-16",
  "resource": {
    "type": "build",
    "labels": {
      "build_id": "07530e91-3ce1-44c5-88a7-b8025758115c",
      "project_id": "test-functions-d4276",
      "build_trigger_id": ""
    }
  },
  "timestamp": "2021-02-08T22:48:20.754221592Z",
  "severity": "INFO",
  "labels": {
    "build_step": "gsutil:STDERR"
  },
  "logName": "projects/test-functions-d4276/logs/cloudbuild",
  "receiveTimestamp": "2021-02-08T22:48:21.560769220Z"
}

Followed by:

{
  "textPayload": "(EOF or read error, treating as \"[N]one\" ...)",
  "insertId": "07530e91-3ce1-44c5-88a7-b8025758115c-17",
  "resource": {
    "type": "build",
    "labels": {
      "build_trigger_id": "",
      "build_id": "07530e91-3ce1-44c5-88a7-b8025758115c",
      "project_id": "test-functions-d4276"
    }
  },
  "timestamp": "2021-02-08T22:48:20.754274058Z",
  "severity": "INFO",
  "labels": {
    "build_step": "gsutil:STDERR"
  },
  "logName": "projects/test-functions-d4276/logs/cloudbuild",
  "receiveTimestamp": "2021-02-08T22:48:21.560769220Z"
}

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 10
  • Comments: 24 (15 by maintainers)

Commits related to this issue

Most upvoted comments

The fix is available in the latest firebase-tools package (>9.4.0).

Hi folks - we are actively taking a look at the issue. Stay tuned.

Here are my steps I followed several times with the same results:

  • start with a virgin m1 macbook air with the exception of installing google chrome
  • install xcode, wait forever 😀
  • run xcode to have it do its thing
  • install nvm using curl
  • install node 15 using nvm, wait forever while it build node
  • test node by running command node --version
  • make sure npm 6+ was installed instead of 7. install npm 6 if 7 is being used
  • use npm to install @angular/cli firebase-tools typescript @ionic/cli parcel-bundler svgo gcloud globally
  • sign into gcloud
  • verify all of the packages i install by running them with out arguments

I have found you are asking for a headache if you don’t install xcode first. For example, git comes from xcode. xcode does some things to your mac when you run it to get things setup for development.

I have done this process 3 times

I have the same error trying to follow https://cloud.google.com/build/docs/deploying-builds/deploy-firebase with

  - name: gcr.io/<projectid>/firebase
    args: ['deploy', '--project=<projectid>', '--only=functions']
replace /workspace/.runtimeconfig.json? [y]es, [n]o, [A]ll, [N]one, [r]ename: NULL
(EOF or read error, treating as "[N]one" ...)
Archive: /tmp/source-archive.zip
ERROR
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

I basically have no control on the architecture/hardware as I am using cloud build’s one. Workaround for me so far is using

  - name: "gcr.io/cloud-builders/gcloud"
    args:
      - functions
      - deploy

Note that deploying storage works

  - name: gcr.io/<projectid>/firebase
    args: ['deploy', '--project=<projectid>', '--only=storage']

Local hardware is Mac x64 but so far I understand my issue, this is irrelevant. I am using node 12.

I’ am use M1 apple-silicon to. With node >14 version firebase-tool doesnt works. I have same error like #3129 With version 15 it works but i am frustrated on the deploy. The deployment is not possible.

I’am am waiting for your update 🥇

Thank you, @taeold! When do you expect you’ll release an updated version?