Repository navigation
Fixing firestore deploy on fresh projects - #9220
Conversation
Summary of ChangesHello @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 resolves critical issues preventing Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request correctly identifies and addresses two key issues that caused deploy --only firestore to fail on new projects. The approach of moving database creation to the prepare step and adding polling for the creation operation is sound. However, I've identified a critical bug in the polling implementation where the result is ignored, along with a couple of minor issues like a duplicated API call and a typo. Addressing these points will ensure the fix is robust and works as intended.
| await pollOperation({ | ||
| apiOrigin: firestoreOrigin(), | ||
| apiVersion: "v1", | ||
| operationResourceName: res.body.name, | ||
| masterTimeout: 600000, | ||
| }); | ||
| const database = res.body.response; |
There was a problem hiding this comment.
There's a critical issue here. The pollOperation is awaited, but its return value (the completed operation details) is discarded. The code then tries to access res.body.response, which comes from the initial POST request that started the long-running operation. For long-running operations, this response field is typically not populated in the initial response.
You need to capture and use the result from pollOperation to get the actual database object after creation.
| await pollOperation({ | |
| apiOrigin: firestoreOrigin(), | |
| apiVersion: "v1", | |
| operationResourceName: res.body.name, | |
| masterTimeout: 600000, | |
| }); | |
| const database = res.body.response; | |
| const database = await pollOperation<types.DatabaseResp>({ | |
| apiOrigin: firestoreOrigin(), | |
| apiVersion: "v1", | |
| operationResourceName: res.body.name, | |
| masterTimeout: 600000, | |
| }); |
There was a problem hiding this comment.
Not relevant in this case - Firestore returns the resource in the initial response.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Description
deploy --only firestorewas breaking on fresh projects for 2 reasons::testendpoint to compile rules before any database was created. This would fail with 403 errors (presumably it needs p4sa provisioning to be performed?)This PR fixes both.
Scenarios tested
Before, broken:


After, working on a fresh project: