Peyman Kheiri
Peyman Kheiri

Reputation: 427

firebase deploy: Error: path-to-file/firestore.indexes.json does not exist

I added the functions folder for firebase cloud functions. But now I can not deploy my Angular project. When I deploy only the function with firebase deploy --only functions it works fine but when I try to deploy my project by running firebase deploy, I get this error:


Error: desktop/projects/my-angular-project/firestore.indexes.json does not exist

my firebase.json file :

{
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**",
      "**/functions/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  },
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "functions": {
    "predeploy": [
      "npm --prefix \"$RESOURCE_DIR\" run lint",
      "npm --prefix \"$RESOURCE_DIR\" run build"
    ]
  }
}

How do I fix this?

Upvotes: 4

Views: 1732

Answers (2)

Frank van Puffelen
Frank van Puffelen

Reputation: 599011

Your firebase.json files has an instruction to deploy security rules and predefined indexes to Firestore here:

  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },

If you don't want either of these to happen, remove that line from the firebase.json.

Upvotes: 12

Peyman Kheiri
Peyman Kheiri

Reputation: 427

I solved it by reinitializing the firebase project firebase init. This time two files were generated in the root directory firebase.rules and firebase.indexes.json which were not there for some reason and the problem was solved.

Upvotes: 0

Related Questions