Skip to content

fix(firestore): log a warning when databaseId is not found#9472

Merged
dlarocque merged 4 commits intomainfrom
dl/db-not-found-log
Jan 29, 2026
Merged

fix(firestore): log a warning when databaseId is not found#9472
dlarocque merged 4 commits intomainfrom
dl/db-not-found-log

Conversation

@dlarocque
Copy link
Contributor

@dlarocque dlarocque commented Jan 29, 2026

When a non-existent databaseId is passed to getFirestore, the SDK fails silently. The WebChannel connection yields no HTTP errors, the SDK throws no exceptions, and nothing is logged. The client eventually falls into offline mode after 10 seconds.

getFirestore('invalid-database-id')
getDocsFromServer(...) // Fails. No error, no warning logs. 

This PR improves DX by intercepting the NOT_FOUND error in the WebChannel connection. If the error message confirms the database itself is missing, we now log a warning to the console.

Note: The detection logic relies on matching the specific string: "The database ... does not exist". This is brittle; if the backend error message changes, this warning will stop appearing. Currently, the backend returns a generic NOT_FOUND status for both missing documents and missing databases. String matching is the only way to distinguish the two scenarios on the client side without backend changes.

@changeset-bot
Copy link

changeset-bot bot commented Jan 29, 2026

🦋 Changeset detected

Latest commit: 4ad0d67

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@firebase/firestore Patch
firebase Patch
@firebase/firestore-compat Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @dlarocque, 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 introduces a targeted logging improvement within the Firestore client's web channel connection logic. By adding a warning message for 'NOT_FOUND' errors, the change aims to enhance diagnostic capabilities, making it easier to identify and resolve issues related to missing databaseId configurations or similar resource unavailability during connection attempts.

Highlights

  • Error Logging: A warning log has been added to the Firestore WebChannel connection handling. Specifically, if an error with status 'NOT_FOUND' occurs, a warning message will now be logged to aid in debugging.

🧠 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
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

This pull request adds a warning log for when a 'NOT_FOUND' status is received from the backend. While this is a good addition for diagnostics, the current log message is too generic. I've provided a suggestion to make the log message more specific and helpful by including the database ID, which will make it easier for developers to debug configuration issues.

@dlarocque
Copy link
Contributor Author

/gemini review

Copy link
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

This pull request adds a helpful warning when a specified Firestore database is not found, which improves the developer experience by providing a clear message for a common configuration error. My review includes a suggestion to make the error message detection more robust against potential changes in the backend's error message format.

@dlarocque dlarocque marked this pull request as ready for review January 29, 2026 18:38
@dlarocque dlarocque requested review from a team as code owners January 29, 2026 18:38
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@dlarocque dlarocque requested a review from hsubox76 January 29, 2026 19:14
@dlarocque dlarocque merged commit 65a553b into main Jan 29, 2026
45 of 48 checks passed
@dlarocque dlarocque deleted the dl/db-not-found-log branch January 29, 2026 19:33
@google-oss-bot google-oss-bot mentioned this pull request Feb 3, 2026
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.

3 participants