Skip to content

Cannot deploy indexes in a project with multiple firestore dbs: TypeError: Cannot read properties of undefined (reading 'map') #8114

Description

@jmysliv

[REQUIRED] Environment info

firebase-tools: 13.29.1

Platform: macOS

[REQUIRED] Test case

A firebase project with one default firestore database and one named firestore database.

[REQUIRED] Steps to reproduce

  1. Create firebase project with firebase init
  2. Create two firestore databases (one default and one named)
  3. Edit firebase.json as described here: https://firebase.google.com/docs/cli#firestore-multiple-dbs
  4. Edit firestore.indexes.json: add some indexes, i.ex.
{
  "indexes": [
    {
      "collectionGroup": "users",
      "queryScope": "COLLECTION",
      "fields": [
        {
          "fieldPath": "language",
          "order": "ASCENDING"
        },
        {
          "fieldPath": "age",
          "order": "ASCENDING"
        }
      ]
    }
  ]
}
  1. Try to deploy those indexes:
firebase deploy --only firestore:indexes

[REQUIRED] Expected behavior

Indexes should be deployed for both databases.

[REQUIRED] Actual behavior

You will see the following logs:

[info] 
[info] === Deploying to 'project_id'...
[info] 
[info] i  deploying firestore 
[info] i  firestore: deploying indexes... 
[debug] [2025-01-13T14:58:39.744Z] TypeError: Cannot read properties of undefined (reading 'map')
    at deployIndexes (<path_to_node_modules>/firebase-tools/lib/deploy/firestore/deploy.js:24:38)
    at default_1 (<path_to_node_modules>/firebase-tools/lib/deploy/firestore/deploy.js:42:46)
    at chain (<path_to_node_modules>/firebase-tools/lib/deploy/index.js:40:15)
    at deploy (<path_to_node_modules>/firebase-tools/lib/deploy/index.js:101:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[error] 
[error] Error: An unexpected error has occurred.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions