Skip to content

Fixing some issues around handling multiple firestore DBs#9770

Open
joehan wants to merge 4 commits intomainfrom
jh-firestore-multidb
Open

Fixing some issues around handling multiple firestore DBs#9770
joehan wants to merge 4 commits intomainfrom
jh-firestore-multidb

Conversation

@joehan
Copy link
Copy Markdown
Member

@joehan joehan commented Jan 21, 2026

Description

Fixes some issues related to handling multiple Firestore DBs during emulation and deployment. Fixes #9742 and #8114

@joehan joehan requested a review from aalej January 21, 2026 03:52
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @joehan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Firebase Firestore emulator by introducing comprehensive support for multiple Firestore databases. It addresses long-standing limitations and bugs, allowing developers to configure, emulate, and manage security rules for several Firestore instances within a single project. This change improves the development workflow for applications utilizing multiple Firestore databases by making the emulator more robust and feature-complete.

Highlights

  • Multi-Database Emulation: The Firestore emulator now fully supports emulating multiple Firestore databases simultaneously, removing previous limitations.
  • Firebase.json Multi-DB Fix: Resolved issues where configuring multiple Firestore databases in firebase.json would lead to errors, specifically addressing Cannot deploy indexes in a project with multiple firestore dbs: TypeError: Cannot read properties of undefined (reading 'map') #8114.
  • Database-Specific Security Rules: Security rules can now be applied and updated on a per-database basis within the emulator, enhancing flexibility for multi-database setups.
  • Improved Configuration Handling: The configuration parsing for firestore:rules and firestore:indexes now correctly includes all database configurations, ensuring comprehensive coverage.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request successfully addresses the issues related to handling multiple Firestore databases during emulation and deployment. The changes in src/emulator/controller.ts correctly adapt the rule processing logic to support multiple configurations, and the FirestoreEmulatorArgs and updateRules method in src/emulator/firestoreEmulator.ts have been updated to reflect this. The new test cases in src/firestore/fsConfig.spec.ts provide good coverage for the getFirestoreConfig function's behavior with firestore:rules and firestore:indexes filters. However, there are a couple of areas that need attention to ensure correctness and efficiency.

Comment thread src/emulator/firestoreEmulator.ts Outdated
Copy link
Copy Markdown
Contributor

@aalej aalej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't seem to run the Firestore emulators. Given this test case https://github.com/aalej/pulls-9770, running firebase emulators:start will raise

Jan 21, 2026 9:50:13 PM com.google.cloud.datastore.emulator.firestore.CloudFirestore main
SEVERE: Exiting due to unexpected exception.
java.io.FileNotFoundException: [object Object],[object Object] (No such file or directory)
	at java.base/java.io.FileInputStream.open0(Native Method)
	at java.base/java.io.FileInputStream.open(FileInputStream.java:213)
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:152)
	at com.google.common.io.Files$FileByteSource.openStream(Files.java:140)
	at com.google.common.io.Files$FileByteSource.read(Files.java:170)
	at com.google.common.io.ByteSource$AsCharSource.read(ByteSource.java:534)
	at com.google.cloud.datastore.emulator.firestore.CloudFirestore.init(CloudFirestore.java:186)
	at com.google.cloud.datastore.emulator.firestore.CloudFirestore.startLocally(CloudFirestore.java:120)
	at com.google.cloud.datastore.emulator.firestore.CloudFirestore.main(CloudFirestore.java:101)

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/util/LegacySystemExit
	at com.google.cloud.datastore.emulator.firestore.CloudFirestore.main(CloudFirestore.java:106)
Caused by: java.lang.ClassNotFoundException: com.google.common.util.LegacySystemExit
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
	... 1 more

Comment thread src/emulator/controller.ts Outdated
@joehan joehan requested a review from aalej May 6, 2026 04:57
@joehan
Copy link
Copy Markdown
Member Author

joehan commented May 6, 2026

@aalej I had jetski split out the emulator changes - this should be good to rereview and hopefully get in for tommorrow

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Firestore Emulator] firestore: Did not find a Cloud Firestore rules file specified in a firebase.json config file.

3 participants