You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reusage of --force flag for function deployment with minimum instances (minimum bill) #6485
firebase-tools: 12.4.4 (should be the same on latest version)
Platform: Docker on Ubuntu on Github Action Runner
[REQUIRED] Test case
Any normal firebase project with some functions. Optionally it is using a CI/CD (non-interactive) to deploy. Adjusting the minInstances to increase the minimum bill of the project, in our case 1 is enough.
.runWith({
minInstances:1
})
[REQUIRED] Steps to reproduce
Deploy the adjusted function optimally via a non interactive terminal, ie. github action.
[REQUIRED] Expected behavior
The function should be deployed with minInstance=1.
[REQUIRED] Actual behavior
Error message: Pass the --force option to deploy functions that increase the minimum bill and deployment is canceled.
The problem is that we can't use the --force flag as this would also auto delete functions. From the help section this behaviour is also not clear. There the force flag is only documented to delete functions:
-f, --force delete Cloud Functions missing from the current working directory without confirmation
Solution Idea
The --force flag should not be reused as a helper for other stuff than the deletion. Probably a separate flag for that would suffice, eg. --allow-bill-increase.
Hi @Buckwich, thanks for raising this issue and providing detailed feedback. Passing the --force flag should only delete functions which are found in your project but do not exist in your local source code.
Just to make sure we’re on the same page here and to get a better understanding of your use case, do you have functions in your project that do not exist in your local source code?
I do agree with your feedback here, a better description for the --force flag could be added, and if there are scenarios where the --force flag would not be ideal to use, adding a separate flag would be a good approach. For now, I’ll mark this as a feature request.
Thanks for your response. Normally we don't have functions without source code, but it has happened and the error (function without source) prevented us from deploying a corrupt state of our project. If we would use --force by default we would miss that valid error.
Hi @Buckwich thanks for opening this issue. We treat min instances a bit special since they change how much customers are billed. We don't want someone to accidentally increase their bill so we gate it around a confirmation. The --force flag has acted as a way to skip these interactive prompts. Adding a separate flag into the CLI is actually a much more involved process on the backend and generally specific product flags are discouraged from the general firebase deploy command, so I don't see us going with that direction. I drafted #6506 for updating the prompt. Thanks and let me know if I missed anything, otherwise I'm going to close this out
Sorry for reopening this, but I just bumped our firebase-functions dependency, does this mean that if we use minInstances: 1 (which we often do), we're now forced to use the --force flag? That seems super scary.
Reacted by Vitor Assis Santos, ytetsuro and David Wisti
I would like to release all the hosting, functions, firestore and realtime databases at the same time.
If I try to avoid this by putting a force option and an only option, I have to put a force option on the hosting, firestore and database together.
Is there any workaround for this?
Activity
aalej commentedon Nov 3, 2023
Hi @Buckwich, thanks for raising this issue and providing detailed feedback. Passing the
--forceflag should only delete functions which are found in your project but do not exist in your local source code.Just to make sure we’re on the same page here and to get a better understanding of your use case, do you have functions in your project that do not exist in your local source code?
I do agree with your feedback here, a better description for the
--forceflag could be added, and if there are scenarios where the--forceflag would not be ideal to use, adding a separate flag would be a good approach. For now, I’ll mark this as a feature request.Buckwich commentedon Nov 3, 2023
Thanks for your response. Normally we don't have functions without source code, but it has happened and the error (function without source) prevented us from deploying a corrupt state of our project. If we would use
--forceby default we would miss that valid error.colerogers commentedon Nov 10, 2023
Hi @Buckwich thanks for opening this issue. We treat min instances a bit special since they change how much customers are billed. We don't want someone to accidentally increase their bill so we gate it around a confirmation. The
--forceflag has acted as a way to skip these interactive prompts. Adding a separate flag into the CLI is actually a much more involved process on the backend and generally specific product flags are discouraged from the generalfirebase deploycommand, so I don't see us going with that direction. I drafted #6506 for updating the prompt. Thanks and let me know if I missed anything, otherwise I'm going to close this outmartolini commentedon Jan 25, 2024
Sorry for reopening this, but I just bumped our
firebase-functionsdependency, does this mean that if we useminInstances: 1(which we often do), we're now forced to use the--forceflag? That seems super scary.vitoras commentedon Mar 25, 2024
I agree with @martolini, I'm facing an issue with cold starts where Google support recommends setting a min instance to our functions (https://www.googlecloudcommunity.com/gc/Serverless/GCP-cloud-function-giving-504-timeout-at-cold-start/m-p/727675), but since I have almost 20 functions, I can't keep then in the same codebase, so therefore, being forced to add the
--forceflag in one of them will force me to delete all of my other functions.There has to be a workaround without having to set min instances manually on a terminal every time we redeploy it.
Edit: Nvm, you could just use the
--onlyflag as well.ytetsuro commentedon Aug 8, 2024
I would like to release all the hosting, functions, firestore and realtime databases at the same time.
If I try to avoid this by putting a force option and an only option, I have to put a force option on the hosting, firestore and database together.
Is there any workaround for this?