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

firebase cli: wait for Firestore indexes deployment #7959

Open
ArturAmpilogov opened this issue Nov 16, 2024 · 4 comments
Open

firebase cli: wait for Firestore indexes deployment #7959

ArturAmpilogov opened this issue Nov 16, 2024 · 4 comments

Comments

@ArturAmpilogov
Copy link

Description

Enabling indexes in databases is a common practice. Many projects dedicate a separate CI step to DB schema/index changes before deploying new application code.

Firebase problem

Firebase provides the following functionality to deploy indexes:

firebase deploy --only=firestore:indexes [--force]

The command does not wait for the end of index deployment in the database. This may result in the following failure:

  1. Run firebase deploy --only=firestore:indexes --force, which is asynchronous operation.
  2. Deploy frontend or backend applications with queries requiring new Firstore indexes.

⚠️ Step 2 is completed, while indexes deployment is still in progress. At runtime, users will see Firestore query errors that require enabling new indexes.

Current workarounds

It is possible to run gcloud firestore operations list command in a loop and check for the related command status completion.

The CI code is challenging for beginners and error-prone for experienced programmers. Adding new database indexes is a common practice, and it will benefit many Firestore users.

Proposal

Introduce

firebase deploy --only=firestore:indexes --wait-all

where --wait-all will force the command to wait for all operations to complete, in this case, indexes deployment.

It is hard to choose the right argument name. For example, firebase deploy --only functions is a synchronous operation that waits for the end of function deployments.


I found several requests for that feature in Stackoverflow and Google community but did not find it in Github. I'm sorry if I missed it. The feature request is also submitted via support page.

@ehsannas
Copy link

Hey @jamesdaniels , could you take a look or route this to the right person?

@joehan
Copy link
Contributor

joehan commented Nov 19, 2024

I'd suggest not adding a flag for this - deploy should be polling on any operations that it starts. I'd want to double check this with Firestore folks, but IMO this should just be the default behavior

@ArturAmpilogov
Copy link
Author

Hi @joehan,
Do you mean the cli deploy command should poll the operation and wait till the end of the deployment,
or should developers write additional custom scripts to check the operation status?

@joehan
Copy link
Contributor

joehan commented Nov 21, 2024

Generally, I think the deploy command should poll the operation and wait till the end of the deployment.
Ideally, deploy should only return once everything is fully deployed.

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

5 participants