Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jmysliv opened this issue Jan 13, 2025 · 1 comment

Comments

@jmysliv
Copy link

jmysliv commented Jan 13, 2025

[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.
@aalej
Copy link
Contributor

aalej commented Jan 13, 2025

Thanks for providing detailed steps to reproduce the issue as well as the error raised, @jmysliv! I'm able to replicate the error you encountered. Let me raise this to our engineering team.

Internal tracking bug: b/389699819

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants