firebase-tools: Deployments are broken

[REQUIRED] Environment info

firebase-tools: 11.1.0

Platform: MacOS

[REQUIRED] Test case

Create a new project and include functions. Try to deploy it.

[REQUIRED] Steps to reproduce

Type firebase deploy in a console on a newly created project.

[REQUIRED] Expected behavior

The application is deployed.

[REQUIRED] Actual behavior

An error is received: Error: An unexpected error has occurred.

i  deploying storage, firestore, functions, hosting, remoteconfig
Running command: npm --prefix "$RESOURCE_DIR" run lint

> lint
> eslint .

✔  functions: Finished running predeploy script.
i  firebase.storage: checking storage.rules for compilation errors...
✔  firebase.storage: rules file storage.rules compiled successfully
i  firestore: reading indexes from firestore.indexes.json...
i  cloud.firestore: checking firestore.rules for compilation errors...
✔  cloud.firestore: rules file firestore.rules compiled successfully
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled
i  functions: preparing codebase default for deployment

Error: An unexpected error has occurred.

Log file:

[debug] [2022-06-17T14:32:40.011Z] ----------------------------------------------------------------------
[debug] [2022-06-17T14:32:40.012Z] Command:       /usr/local/Cellar/node@16/16.14.0_1/bin/node /usr/local/bin/firebase deploy
[debug] [2022-06-17T14:32:40.013Z] CLI Version:   11.1.0
[debug] [2022-06-17T14:32:40.013Z] Platform:      darwin
[debug] [2022-06-17T14:32:40.013Z] Node Version:  v16.14.0
[debug] [2022-06-17T14:32:40.014Z] Time:          Fri Jun 17 2022 10:32:40 GMT-0400 (Eastern Daylight Time)
[debug] [2022-06-17T14:32:40.014Z] ----------------------------------------------------------------------
[debug] 
[debug] [2022-06-17T14:32:40.057Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2022-06-17T14:32:40.057Z] > authorizing via signed-in user 
[debug] [2022-06-17T14:32:40.058Z] [iam] checking project xxx-352903 for permissions ["cloudconfig.configs.get","cloudconfig.configs.update","cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","datastore.indexes.create","datastore.indexes.delete","datastore.indexes.list","datastore.indexes.update","firebase.projects.get","firebasehosting.sites.update","firebaserules.releases.create","firebaserules.releases.update","firebaserules.rulesets.create"]
[debug] [2022-06-17T14:32:40.060Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/xxx-352903:testIamPermissions [none]
[debug] [2022-06-17T14:32:40.061Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/xxx-352903:testIamPermissions {"permissions":["cloudconfig.configs.get","cloudconfig.configs.update","cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","datastore.indexes.create","datastore.indexes.delete","datastore.indexes.list","datastore.indexes.update","firebase.projects.get","firebasehosting.sites.update","firebaserules.releases.create","firebaserules.releases.update","firebaserules.rulesets.create"]}
[debug] [2022-06-17T14:32:40.264Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/xxx-352903:testIamPermissions 200
[debug] [2022-06-17T14:32:40.264Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/xxx-352903:testIamPermissions {"permissions":["cloudconfig.configs.get","cloudconfig.configs.update","cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","datastore.indexes.create","datastore.indexes.delete","datastore.indexes.list","datastore.indexes.update","firebase.projects.get","firebasehosting.sites.update","firebaserules.releases.create","firebaserules.releases.update","firebaserules.rulesets.create"]}
[debug] [2022-06-17T14:32:40.264Z] >>> [apiv2][query] POST https://iam.googleapis.com/v1/projects/xxx-352903/serviceAccounts/xxx-352903@appspot.gserviceaccount.com:testIamPermissions [none]
[debug] [2022-06-17T14:32:40.265Z] >>> [apiv2][body] POST https://iam.googleapis.com/v1/projects/xxx-352903/serviceAccounts/xxx-352903@appspot.gserviceaccount.com:testIamPermissions {"permissions":["iam.serviceAccounts.actAs"]}
[debug] [2022-06-17T14:32:40.468Z] <<< [apiv2][status] POST https://iam.googleapis.com/v1/projects/xxx-352903/serviceAccounts/xxx-352903@appspot.gserviceaccount.com:testIamPermissions 200
[debug] [2022-06-17T14:32:40.468Z] <<< [apiv2][body] POST https://iam.googleapis.com/v1/projects/xxx-352903/serviceAccounts/xxx-352903@appspot.gserviceaccount.com:testIamPermissions {"permissions":["iam.serviceAccounts.actAs"]}
[debug] [2022-06-17T14:32:40.469Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/xxx-352903 [none]
[debug] [2022-06-17T14:32:40.693Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/xxx-352903 200
[debug] [2022-06-17T14:32:40.693Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/xxx-352903 {"projectId":"xxx-352903","projectNumber":"1076835591828","displayName":"xxx","name":"projects/xxx-352903","resources":{"hostingSite":"xxx-352903","storageBucket":"xxx-352903.appspot.com","locationId":"us-central"},"state":"ACTIVE"}
[info] 
[info] === Deploying to 'xxx-352903'...
[info] 
[info] i  deploying storage, firestore, functions, hosting, remoteconfig 
[info] Running command: npm --prefix "$RESOURCE_DIR" run lint
[info] ✔  functions: Finished running predeploy script. 
[debug] [2022-06-17T14:32:41.369Z] >>> [apiv2][query] GET https://appengine.googleapis.com/v1/apps/xxx-352903 [none]
[debug] [2022-06-17T14:32:41.610Z] <<< [apiv2][status] GET https://appengine.googleapis.com/v1/apps/xxx-352903 200
[debug] [2022-06-17T14:32:41.610Z] <<< [apiv2][body] GET https://appengine.googleapis.com/v1/apps/xxx-352903 {"name":"apps/xxx-352903","id":"xxx-352903","authDomain":"gmail.com","locationId":"us-central","codeBucket":"staging.xxx-352903.appspot.com","servingStatus":"SERVING","defaultHostname":"xxx-352903.uc.r.appspot.com","defaultBucket":"xxx-352903.appspot.com","serviceAccount":"xxx-352903@appspot.gserviceaccount.com","gcrDomain":"us.gcr.io","databaseType":"CLOUD_FIRESTORE","featureSettings":{"splitHealthChecks":true,"useContainerOptimizedOs":true}}
[info] i  firebase.storage: checking storage.rules for compilation errors... 
[debug] [2022-06-17T14:32:41.611Z] >>> [apiv2][query] POST https://firebaserules.googleapis.com/v1/projects/xxx-352903:test [none]
[debug] [2022-06-17T14:32:41.611Z] >>> [apiv2][body] POST https://firebaserules.googleapis.com/v1/projects/xxx-352903:test [omitted]
[debug] [2022-06-17T14:32:41.788Z] <<< [apiv2][status] POST https://firebaserules.googleapis.com/v1/projects/xxx-352903:test 200
[debug] [2022-06-17T14:32:41.788Z] <<< [apiv2][body] POST https://firebaserules.googleapis.com/v1/projects/xxx-352903:test {}
[info] ✔  firebase.storage: rules file storage.rules compiled successfully 
[info] i  firestore: reading indexes from firestore.indexes.json... 
[info] i  cloud.firestore: checking firestore.rules for compilation errors... 
[debug] [2022-06-17T14:32:41.790Z] >>> [apiv2][query] POST https://firebaserules.googleapis.com/v1/projects/xxx-352903:test [none]
[debug] [2022-06-17T14:32:41.790Z] >>> [apiv2][body] POST https://firebaserules.googleapis.com/v1/projects/xxx-352903:test [omitted]
[debug] [2022-06-17T14:32:41.966Z] <<< [apiv2][status] POST https://firebaserules.googleapis.com/v1/projects/xxx-352903:test 200
[debug] [2022-06-17T14:32:41.966Z] <<< [apiv2][body] POST https://firebaserules.googleapis.com/v1/projects/xxx-352903:test {}
[info] ✔  cloud.firestore: rules file firestore.rules compiled successfully 
[debug] [2022-06-17T14:32:41.967Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/xxx-352903 [none]
[debug] [2022-06-17T14:32:42.171Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/xxx-352903 200
[debug] [2022-06-17T14:32:42.171Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/xxx-352903 {"projectId":"xxx-352903","projectNumber":"1076835591828","displayName":"xxx","name":"projects/xxx-352903","resources":{"hostingSite":"xxx-352903","storageBucket":"xxx-352903.appspot.com","locationId":"us-central"},"state":"ACTIVE"}
[info] i  functions: ensuring required API cloudfunctions.googleapis.com is enabled... 
[info] i  functions: ensuring required API cloudbuild.googleapis.com is enabled... 
[debug] [2022-06-17T14:32:42.173Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/cloudfunctions.googleapis.com [none]
[debug] [2022-06-17T14:32:42.174Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/runtimeconfig.googleapis.com [none]
[debug] [2022-06-17T14:32:42.175Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/cloudbuild.googleapis.com [none]
[debug] [2022-06-17T14:32:42.176Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/artifactregistry.googleapis.com [none]
[debug] [2022-06-17T14:32:42.486Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/artifactregistry.googleapis.com 200
[debug] [2022-06-17T14:32:42.486Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/artifactregistry.googleapis.com [omitted]
[debug] [2022-06-17T14:32:42.491Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/cloudfunctions.googleapis.com 200
[debug] [2022-06-17T14:32:42.491Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/cloudfunctions.googleapis.com [omitted]
[info] ✔  functions: required API cloudfunctions.googleapis.com is enabled 
[debug] [2022-06-17T14:32:42.492Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/runtimeconfig.googleapis.com 200
[debug] [2022-06-17T14:32:42.492Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/runtimeconfig.googleapis.com [omitted]
[debug] [2022-06-17T14:32:42.498Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/cloudbuild.googleapis.com 200
[debug] [2022-06-17T14:32:42.498Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/cloudbuild.googleapis.com [omitted]
[info] ✔  functions: required API cloudbuild.googleapis.com is enabled 
[debug] [2022-06-17T14:32:42.498Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/xxx-352903/adminSdkConfig [none]
[debug] [2022-06-17T14:32:42.686Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/xxx-352903/adminSdkConfig 200
[debug] [2022-06-17T14:32:42.686Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/xxx-352903/adminSdkConfig {"projectId":"xxx-352903","storageBucket":"xxx-352903.appspot.com","locationId":"us-central"}
[debug] [2022-06-17T14:32:42.686Z] >>> [apiv2][query] GET https://runtimeconfig.googleapis.com/v1beta1/projects/xxx-352903/configs [none]
[debug] [2022-06-17T14:32:43.012Z] <<< [apiv2][status] GET https://runtimeconfig.googleapis.com/v1beta1/projects/xxx-352903/configs 200
[debug] [2022-06-17T14:32:43.013Z] <<< [apiv2][body] GET https://runtimeconfig.googleapis.com/v1beta1/projects/xxx-352903/configs {}
[info] i  functions: preparing codebase default for deployment 
[debug] [2022-06-17T14:32:43.014Z] Validating nodejs source
[debug] [2022-06-17T14:32:44.001Z] > [functions] package.json contents: {
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "lint": "eslint .",
    "serve": "firebase emulators:start --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "16"
  },
  "main": "index.js",
  "dependencies": {
    "firebase-admin": "^10.0.2",
    "firebase-functions": "^3.18.0"
  },
  "devDependencies": {
    "eslint": "^8.9.0",
    "eslint-config-google": "^0.14.0",
    "firebase-functions-test": "^0.2.0"
  },
  "private": true
}
[debug] [2022-06-17T14:32:44.002Z] Building nodejs source
[debug] [2022-06-17T14:32:44.002Z] Analyzing nodejs backend spec
[debug] [2022-06-17T14:32:44.003Z] Could not find functions.yaml. Must use http discovery
[debug] [2022-06-17T14:32:44.016Z] Error: spawn ./node_modules/.bin/firebase-functions ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:478:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
[error] 
[error] Error: An unexpected error has occurred.
[debug] [2022-06-17T14:32:44.139Z] Serving at port 9009

[debug] [2022-06-17T14:32:44.179Z] Got response from /__/functions.yaml {"endpoints":{"helloWorld":{"platform":"gcfv1","httpsTrigger":{},"entryPoint":"helloWorld"}},"specVersion":"v1alpha1","requiredAPIs":[]}
[debug] [2022-06-17T14:32:44.185Z] shutdown requested via /__/quitquitquit

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (9 by maintainers)

Most upvoted comments

After many hours I was able to fix this on my machine. It seems as if the latest version of firebase tools caused this error. I have downgraded to firebase-tools@10.2.0 (not sure if this is the lates version that would work or not, but this one worked for me). npm install -g firebase-tools@10.2.0 to install a specific version, you will have to restart your IED or command terminal for this to take effect. Hope this fix will help your problem.