firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.01k stars 929 forks source link

Firebase deployment started failing since 01/06 #7294

Open Endran opened 3 months ago

Endran commented 3 months ago

[REQUIRED] Environment info

firebase-tools: firebase-tools@13.11.1

Platform: docker: node:20.10.0-alpine

[REQUIRED] Test case

I am trying to deploy our project. It's a product running on Firebase since 2019, well maintained, with developers that use firebase on a daily basis. Since last week the deployment of the project started failing, even builds that deployed fine the week before can no longer be deployed.

My guess somewhere in the firebase-tools, Firebase or GCP landscape something has been updated causing this outage. See Perhaps also related to https://github.com/firebase/firebase-tools/issues/7268#issuecomment-2154523744 as well.

[REQUIRED] Steps to reproduce

firebase deploy --force --token $FIREBASE_TOKEN --except functions

[REQUIRED] Expected behavior

Deploy everything except functions

[REQUIRED] Actual behavior

Unstable deployment behaviour, start somewhere last week.

cloud.firestore: rules file firestore.rules compiled successfully
storage:  latest version of storage.rules already up to date, skipping upload...
firestore: deploying indexes...
firestore: uploading rules firestore.rules...
Error: HTTP Error: 400, Updating ttl other than single field level is not supported: UpdateFieldConfigurationRequest{ref=SingleFieldRef{referenceType=ReferenceType{kind=notIndexed}}, indexingMode=IndexingMode{enable=[]}, expirationMode=DISABLE, validateOnly=false}
Endran commented 3 months ago

Nevermind, I found it. It's still a bug, but not spontaneous. Due to https://github.com/firebase/firebase-tools/issues/7268#issuecomment-2154523744 we have a backlog of changes piling up, and this issue was caused by one of the changes.

We changed index settings via the console, and then ran firebase firestore:indexes. We copied the result into firestore.indexes.json, so that staging/prod will receive these changes. Appearently the ttl must not be copied from the result (see https://github.com/firebase/firebase-tools/issues/6569).

The result from firebase firestore:indexes.

  "fieldOverrides": [
    {
      "collectionGroup": "notIndexed",
      "fieldPath": "*",
      "ttl": false,         <== Do not copy this ttl line to your local `firestore.indexes.json`
      "indexes": []
    }
  ]
jdcoldsmith commented 1 month ago

@Endran Thank you for this solution! My team found it very useful!