firebase-tools
firebase-tools copied to clipboard
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/[email protected]:testIamPermissions [none]
[debug] [2022-06-17T14:32:40.265Z] >>> [apiv2][body] POST https://iam.googleapis.com/v1/projects/xxx-352903/serviceAccounts/[email protected]:testIamPermissions {"permissions":["iam.serviceAccounts.actAs"]}
[debug] [2022-06-17T14:32:40.468Z] <<< [apiv2][status] POST https://iam.googleapis.com/v1/projects/xxx-352903/serviceAccounts/[email protected]:testIamPermissions 200
[debug] [2022-06-17T14:32:40.468Z] <<< [apiv2][body] POST https://iam.googleapis.com/v1/projects/xxx-352903/serviceAccounts/[email protected]: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":"[email protected]","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
Have you run npm install in your directory with your functions? If it's not finding the firebase-functions binary, that's usually why.
Indeed, I have.
(base) josh@mbp functions % npm install
up to date, audited 299 packages in 762ms
27 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
(base) josh@mbp functions % cd ..
(base) josh@mbp server % firebase deploy
=== Deploying to 'xxx-352903'...
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 cloudfunctions.googleapis.com is enabled
✔ functions: required API cloudbuild.googleapis.com is enabled
i functions: preparing codebase default for deployment
Error: An unexpected error has occurred.
(base) josh@mbp server %
@jjonte-dwellup could you reduce the number of things you're deploying and try again? You're deploying all of "storage, firestore, functions, hosting, remoteconfig" - can you --only each of those and see where the problem stems from? I'm unable to replicate this just by initializing a project with functions, so it's probably coming from something else.
Sure.
(base) josh@mbp server % firebase deploy --only functions
=== Deploying to 'xxx-352903'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> lint
> eslint .
✔ functions: Finished running predeploy script.
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.
(base) josh@mbp server %
Logfile
[debug] [2022-06-17T16:56:12.191Z] ----------------------------------------------------------------------
[debug] [2022-06-17T16:56:12.192Z] Command: /usr/local/Cellar/node@16/16.14.0_1/bin/node /usr/local/bin/firebase deploy --only functions
[debug] [2022-06-17T16:56:12.193Z] CLI Version: 11.1.0
[debug] [2022-06-17T16:56:12.193Z] Platform: darwin
[debug] [2022-06-17T16:56:12.193Z] Node Version: v16.14.0
[debug] [2022-06-17T16:56:12.194Z] Time: Fri Jun 17 2022 12:56:12 GMT-0400 (Eastern Daylight Time)
[debug] [2022-06-17T16:56:12.194Z] ----------------------------------------------------------------------
[debug]
[debug] [2022-06-17T16:56:12.242Z] > 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-17T16:56:12.242Z] > authorizing via signed-in user ([email protected])
[debug] [2022-06-17T16:56:12.242Z] [iam] checking project xxx-352903 for permissions ["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]
[debug] [2022-06-17T16:56:12.245Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/xxx-352903:testIamPermissions [none]
[debug] [2022-06-17T16:56:12.245Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/xxx-352903:testIamPermissions {"permissions":["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]}
[debug] [2022-06-17T16:56:12.434Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/xxx-352903:testIamPermissions 200
[debug] [2022-06-17T16:56:12.434Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/xxx-352903:testIamPermissions {"permissions":["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]}
[debug] [2022-06-17T16:56:12.434Z] >>> [apiv2][query] POST https://iam.googleapis.com/v1/projects/xxx-352903/serviceAccounts/[email protected]:testIamPermissions [none]
[debug] [2022-06-17T16:56:12.435Z] >>> [apiv2][body] POST https://iam.googleapis.com/v1/projects/xxx-352903/serviceAccounts/[email protected]:testIamPermissions {"permissions":["iam.serviceAccounts.actAs"]}
[debug] [2022-06-17T16:56:12.587Z] <<< [apiv2][status] POST https://iam.googleapis.com/v1/projects/xxx-352903/serviceAccounts/[email protected]:testIamPermissions 200
[debug] [2022-06-17T16:56:12.587Z] <<< [apiv2][body] POST https://iam.googleapis.com/v1/projects/xxx-352903/serviceAccounts/[email protected]:testIamPermissions {"permissions":["iam.serviceAccounts.actAs"]}
[info]
[info] === Deploying to 'xxx-352903'...
[info]
[info] i deploying functions
[info] Running command: npm --prefix "$RESOURCE_DIR" run lint
[info] ✔ functions: Finished running predeploy script.
[debug] [2022-06-17T16:56:13.270Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/xxx-352903 [none]
[debug] [2022-06-17T16:56:13.493Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/xxx-352903 200
[debug] [2022-06-17T16:56:13.493Z] <<< [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-17T16:56:13.495Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/cloudfunctions.googleapis.com [none]
[debug] [2022-06-17T16:56:13.496Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/runtimeconfig.googleapis.com [none]
[debug] [2022-06-17T16:56:13.497Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/cloudbuild.googleapis.com [none]
[debug] [2022-06-17T16:56:13.497Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/artifactregistry.googleapis.com [none]
[debug] [2022-06-17T16:56:13.783Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/cloudbuild.googleapis.com 200
[debug] [2022-06-17T16:56:13.783Z] <<< [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-17T16:56:13.784Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/cloudfunctions.googleapis.com 200
[debug] [2022-06-17T16:56:13.784Z] <<< [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-17T16:56:13.786Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/artifactregistry.googleapis.com 200
[debug] [2022-06-17T16:56:13.786Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/artifactregistry.googleapis.com [omitted]
[debug] [2022-06-17T16:56:13.798Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/runtimeconfig.googleapis.com 200
[debug] [2022-06-17T16:56:13.798Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/xxx-352903/services/runtimeconfig.googleapis.com [omitted]
[debug] [2022-06-17T16:56:13.798Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/xxx-352903/adminSdkConfig [none]
[debug] [2022-06-17T16:56:13.973Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/xxx-352903/adminSdkConfig 200
[debug] [2022-06-17T16:56:13.973Z] <<< [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-17T16:56:13.974Z] >>> [apiv2][query] GET https://runtimeconfig.googleapis.com/v1beta1/projects/xxx-352903/configs [none]
[debug] [2022-06-17T16:56:14.336Z] <<< [apiv2][status] GET https://runtimeconfig.googleapis.com/v1beta1/projects/xxx-352903/configs 200
[debug] [2022-06-17T16:56:14.336Z] <<< [apiv2][body] GET https://runtimeconfig.googleapis.com/v1beta1/projects/xxx-352903/configs {}
[info] i functions: preparing codebase default for deployment
[debug] [2022-06-17T16:56:14.338Z] Validating nodejs source
[debug] [2022-06-17T16:56:15.280Z] > [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-17T16:56:15.281Z] Building nodejs source
[debug] [2022-06-17T16:56:15.281Z] Analyzing nodejs backend spec
[debug] [2022-06-17T16:56:15.282Z] Could not find functions.yaml. Must use http discovery
[debug] [2022-06-17T16:56:15.294Z] 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-17T16:56:15.417Z] Serving at port 9009
[debug] [2022-06-17T16:56:15.458Z] Got response from /__/functions.yaml {"endpoints":{"helloWorld":{"platform":"gcfv1","httpsTrigger":{},"entryPoint":"helloWorld"}},"specVersion":"v1alpha1","requiredAPIs":[]}
[debug] [2022-06-17T16:56:15.464Z] shutdown requested via /__/quitquitquit
Ahh - last guess - can you update your version of firebase-functions? I think there's a minimum required version of 3.20.0 at this point. doing npm i --save firebase-functions@latest in your functions directory doesn't fix this, I'd be very stumped.
If that does fix it, then there's an issue where we aren't making that check correctly and will have to fix it.
Done, but it did not resolve the issue.
(base) josh@mbp server % cd functions
(base) josh@mbp functions % npm i --save firebase-functions@latest
up to date, audited 299 packages in 971ms
27 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
(base) josh@mbp functions % cd ..
(base) josh@mbp server % firebase deploy --only functions
=== Deploying to 'xxx-352903'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> lint
> eslint .
✔ functions: Finished running predeploy script.
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: required API cloudbuild.googleapis.com is enabled
i functions: preparing codebase default for deployment
Error: An unexpected error has occurred.
(base) josh@mbp server %
Curiously, when I try to start the functions emulator from the project's root directory , I receive the same, totally useless error message. However when I start the emulator from the functions directory it starts up no problem.
(base) josh@mbp server % firebase emulators:start --only functions
i emulators: Starting emulators: functions
⚠ functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: auth, firestore, database, hosting, pubsub, storage
✔ functions: Using node@16 from host.
⚠ ui: Emulator UI unable to start on port 4000, starting on 4006 instead.
i ui: Emulator UI logging to ui-debug.log
i functions: Watching "/Users/josh/dev/personal/server/functions" for Cloud Functions...
Error: An unexpected error has occurred.
(base) josh@mbp server % cd functions
(base) josh@mbp functions % firebase emulators:start --only functions
i emulators: Starting emulators: functions
⚠ emulators: It seems that you are running multiple instances of the emulator suite for project xxx-352903. This may result in unexpected behavior.
⚠ functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: auth, firestore, database, hosting, pubsub, storage
✔ functions: Using node@16 from host.
⚠ ui: Emulator UI unable to start on port 4000, starting on 4007 instead.
i ui: Emulator UI logging to ui-debug.log
i functions: Watching "/Users/josh/dev/personal/server/functions" for Cloud Functions...
✔ functions[us-central1-helloWorld]: http function initialized (http://localhost:5001/xxx-352903/us-central1/helloWorld).
┌─────────────────────────────────────────────────────────────┐
│ ✔ All emulators ready! It is now safe to connect your app. │
│ i View Emulator UI at http://localhost:4007 │
└─────────────────────────────────────────────────────────────┘
┌───────────┬────────────────┬─────────────────────────────────┐
│ Emulator │ Host:Port │ View in Emulator UI │
├───────────┼────────────────┼─────────────────────────────────┤
│ Functions │ localhost:5001 │ http://localhost:4007/functions │
└───────────┴────────────────┴─────────────────────────────────┘
Emulator Hub running at localhost:4400
Other reserved ports: 4500
Issues? Report them at https://github.com/firebase/firebase-tools/issues and attach the *-debug.log files.
Have you found the cause of this issue? Im running into the same problem.
Have you found the cause of this issue? Im running into the same problem.
I have not.
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 [email protected] (not sure if this is the lates version that would work or not, but this one worked for me). npm install -g [email protected] 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.
I'm getting a similar issue when I try to deploy a single function with v11.2.2 (and anything after v11 in general)
Here's my firebase-debug.log file:
[debug] [2022-07-17T21:38:27.303Z] ----------------------------------------------------------------------
[debug] [2022-07-17T21:38:27.303Z] Command: /Users/toni/.nvm/versions/node/v16.13.1/bin/node /Users/toni/.nvm/versions/node/v16.13.1/bin/firebase deploy --only functions:onWriteFabric
[debug] [2022-07-17T21:38:27.304Z] CLI Version: 11.2.2
[debug] [2022-07-17T21:38:27.304Z] Platform: darwin
[debug] [2022-07-17T21:38:27.304Z] Node Version: v16.13.1
[debug] [2022-07-17T21:38:27.305Z] Time: Sun Jul 17 2022 23:38:27 GMT+0200 (Central European Summer Time)
[debug] [2022-07-17T21:38:27.305Z] ----------------------------------------------------------------------
[debug]
[debug] [2022-07-17T21:38:27.331Z] > 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-07-17T21:38:27.332Z] > authorizing via signed-in user (<redacted>)
[debug] [2022-07-17T21:38:27.332Z] [iam] checking project redacted-project for permissions ["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]
[debug] [2022-07-17T21:38:27.332Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/redacted-project:testIamPermissions [none]
[debug] [2022-07-17T21:38:27.333Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/redacted-project:testIamPermissions {"permissions":["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]}
[debug] [2022-07-17T21:38:28.445Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/redacted-project:testIamPermissions 200
[debug] [2022-07-17T21:38:28.445Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/redacted-project:testIamPermissions {"permissions":["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]}
[debug] [2022-07-17T21:38:28.446Z] >>> [apiv2][query] POST https://iam.googleapis.com/v1/projects/redacted-project/serviceAccounts/[email protected]:testIamPermissions [none]
[debug] [2022-07-17T21:38:28.446Z] >>> [apiv2][body] POST https://iam.googleapis.com/v1/projects/redacted-project/serviceAccounts/[email protected]:testIamPermissions {"permissions":["iam.serviceAccounts.actAs"]}
[debug] [2022-07-17T21:38:29.222Z] <<< [apiv2][status] POST https://iam.googleapis.com/v1/projects/redacted-project/serviceAccounts/[email protected]:testIamPermissions 200
[debug] [2022-07-17T21:38:29.223Z] <<< [apiv2][body] POST https://iam.googleapis.com/v1/projects/redacted-project/serviceAccounts/[email protected]:testIamPermissions {"permissions":["iam.serviceAccounts.actAs"]}
[info]
[info] === Deploying to 'redacted-project'...
[info]
[info] i deploying functions
[info] Running command: npm --prefix "$RESOURCE_DIR" run lint
[info] Running command: npm --prefix "$RESOURCE_DIR" run build
[info] ✔ functions: Finished running predeploy script.
[debug] [2022-07-17T21:38:31.951Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/redacted-project [none]
[debug] [2022-07-17T21:38:32.216Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/redacted-project 200
[debug] [2022-07-17T21:38:32.217Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/redacted-project {"projectId":"redacted-project","projectNumber":"253280152690","displayName":"Stitch","name":"projects/redacted-project","resources":{"hostingSite":"redacted-project","storageBucket":"redacted-project.appspot.com","locationId":"europe-west"},"state":"ACTIVE"}
[info] i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
[info] i functions: ensuring required API cloudbuild.googleapis.com is enabled...
[info] i artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
[debug] [2022-07-17T21:38:32.220Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/redacted-project/services/cloudfunctions.googleapis.com [none]
[debug] [2022-07-17T21:38:32.221Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/redacted-project/services/runtimeconfig.googleapis.com [none]
[debug] [2022-07-17T21:38:32.222Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/redacted-project/services/cloudbuild.googleapis.com [none]
[debug] [2022-07-17T21:38:32.223Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/redacted-project/services/artifactregistry.googleapis.com [none]
[debug] [2022-07-17T21:38:33.147Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/redacted-project/services/runtimeconfig.googleapis.com 200
[debug] [2022-07-17T21:38:33.148Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/redacted-project/services/runtimeconfig.googleapis.com [omitted]
[debug] [2022-07-17T21:38:33.149Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/redacted-project/services/artifactregistry.googleapis.com 200
[debug] [2022-07-17T21:38:33.149Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/redacted-project/services/artifactregistry.googleapis.com [omitted]
[info] ✔ artifactregistry: required API artifactregistry.googleapis.com is enabled
[debug] [2022-07-17T21:38:33.151Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/redacted-project/services/cloudfunctions.googleapis.com 200
[debug] [2022-07-17T21:38:33.151Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/redacted-project/services/cloudfunctions.googleapis.com [omitted]
[info] ✔ functions: required API cloudfunctions.googleapis.com is enabled
[debug] [2022-07-17T21:38:33.152Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/redacted-project/services/cloudbuild.googleapis.com 200
[debug] [2022-07-17T21:38:33.152Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/redacted-project/services/cloudbuild.googleapis.com [omitted]
[info] ✔ functions: required API cloudbuild.googleapis.com is enabled
[debug] [2022-07-17T21:38:33.153Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/redacted-project/adminSdkConfig [none]
[debug] [2022-07-17T21:38:33.452Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/redacted-project/adminSdkConfig 200
[debug] [2022-07-17T21:38:33.452Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/redacted-project/adminSdkConfig {"projectId":"redacted-project","storageBucket":"redacted-project.appspot.com","locationId":"europe-west"}
[debug] [2022-07-17T21:38:33.453Z] >>> [apiv2][query] GET https://runtimeconfig.googleapis.com/v1beta1/projects/redacted-project/configs [none]
[debug] [2022-07-17T21:38:34.375Z] <<< [apiv2][status] GET https://runtimeconfig.googleapis.com/v1beta1/projects/redacted-project/configs 200
[debug] [2022-07-17T21:38:34.375Z] <<< [apiv2][body] GET https://runtimeconfig.googleapis.com/v1beta1/projects/redacted-project/configs {}
[info] i functions: preparing codebase default for deployment
[debug] [2022-07-17T21:38:34.378Z] Validating nodejs source
[debug] [2022-07-17T21:38:35.314Z] > [functions] package.json contents: {
"name": "functions",
"scripts": {
"lint": "echo 'eslint --ext .js,.ts .'",
"build": "tsc",
"serve": "npm run build && firebase emulators:start --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "16"
},
"main": "lib/index.js",
"dependencies": {
"color-classifier": "^0.0.1",
"fast-crc32c": "^2.0.0",
"firebase-admin": "^10.0.2",
"firebase-functions": "^3.22.0",
"node-vibrant": "^3.2.1-alpha.1"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.12.0",
"@typescript-eslint/parser": "^5.12.0",
"eslint": "^8.9.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-import": "^2.25.4",
"firebase-functions-test": "^0.2.0",
"typescript": "^4.5.4"
},
"private": true
}
[debug] [2022-07-17T21:38:35.314Z] Building nodejs source
[debug] [2022-07-17T21:38:35.314Z] Could not find functions.yaml. Must use http discovery
[debug] [2022-07-17T21:38:35.413Z] Serving at port 9006
[debug] [2022-07-17T21:38:35.694Z] FetchError: request to http://localhost:9006/__/quitquitquit failed, reason: connect ECONNREFUSED 127.0.0.1:9006
at ClientRequest.<anonymous> (/Users/toni/.nvm/versions/node/v16.13.1/lib/node_modules/firebase-tools/node_modules/node-fetch/lib/index.js:1491:11)
at ClientRequest.emit (node:events:390:28)
at ClientRequest.emit (node:domain:475:12)
at Socket.socketErrorListener (node:_http_client:447:9)
at Socket.emit (node:events:390:28)
at Socket.emit (node:domain:475:12)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
[error]
[error] Error: An unexpected error has occurred.
I tried downgrading to several lower firebase-tools versions (including v10) like Luka suggested, but that just gave me another kind error.
@ts95 Sorry for the troubles. I think we need to improve on emitting better debug logs that helps with debugging the underlying issue.
I remember helping another customer with an error message like yours, and it ended up being that there was an issue with the source code of the functions and the CLI failing to load it as a result. Are you able to fire up an emulator and test your functions? If not, that would mean that there is a runtime error unrelated to the deployment process.
I did manage to get it work actually. I killed the process that used port 9006, then I downgraded to [email protected]. I also noticed that I was running Node.js 17 instead of Node.js 16, so I downgraded to the latter. After all that it started working. Interestingly, now it also works on v11.2.2 of firebase-tools.
If anyone is still running into this issue after upgrading to the latest firebase-tools & firebase-functions, can you create a minimum reproducible sample and link it here please. Thanks
Hey @jjonte-dwellup. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
I've had the same issue since v10.9.0 (with the last working version being the one prior v10.8.0), so it's likely that a change made between those versions is the culprit.
@GarrickBrown Do you mind sharing your setup with us? (Are you using pnpm or other monorepo tooling by any chance?)
In this particular issue, version of the firebase-functions package is relevant too - please share if you can!
@taeold no we aren't using pnpm or other monorepo, pretty basic setup. We have kept firebase-functions up-to-date (currently running v3.22.0), so unfortunately I'm not sure which version we were on when we first noticed this issue.
Hey @jjonte-dwellup. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Since there haven't been any recent updates here, I am going to close this issue.
@jjonte-dwellup if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.