Firebase "Blaze" projects limit, multiple env and Spark plan outbound requests - firebase

I'm working with Firebase and quite enjoying it so far.
I'm working with DEV, PREPROD and PROD environments for each of my projects. For each env I've had to create a distinct firebase project.
Since my app is using Algolia and Cloud vision API, I apparently have to be on the Blaze plan because Spark plan doesn't allow outbound requests and Cloud vision API calls (if I'm correct).
The thing is we're limited with the numbers of Blaze projects we can have at the same time. Above a certain amount (6 or 7, I think) we have to request a "billing quota increase" and explain why we need more (sounds odd but ok).
So I did, but now Firebase is asking for a $50 transaction to increase the number of Blaze projects I can have.
So I have several questions:
- Am I right to think that in Spark plan I can't call the Algolia API in my cloud functions or call Cloud vision API ?
- Are these $50 a payment to unlock new projects slots or just credits that will be available if needed ?
- If I need even more projects in the future will I have to pay even more credits ?
- How am I supposed to handle separate environments on Firebase without creating a different project each time ?
Thanks a lot

On the Spark plan, with Cloud Functions, you can only make outgoing connections to services that Google fully controls. Algolia will not work.
Please read the FAQ regarding the number of projects you may have and the payment being asked to create a new project:
Why am I being asked to make a payment for more projects?
You may be asked to make a payment if your request for more projects
indicates that you need projects that will use paid cloud services.
The payment can be applied to any charges you incur in the future and
will be visible as a credit in your account.
This payment is required to ensure paid services will be available for
the projects you requested in the quota increase request form. This is
a common requirement, because Google Cloud Platform services are paid
(e.g., Compute Engine, Cloud SQL, and BigQuery).
The payment required varies depending on your billing history, the use
cases described in your request form, the number of projects you
request, and other factors.
So, the $50 you are being asked to pay will apply as credit to your project billing.
You should definitely create new projects for each environment.

Related

How can you limit the billing in firebase? They used to have this possibility, it looks like they removed it [duplicate]

I'm currently working in a social network app and I need to do a search feature. Firestore does not support these kind of queries, so I need to use an external service like Algolia.
The problem is that the free plan does not support connecting to external websites/APIs other than Google's own ones, so I can't connect to Algolia to get my search system working.
I have read multiple stories about devs paying high bills because of loops or errors in their code, and as the Blaze plan is a pay-to-go plan, they get charged what they used. If a loop generated 10TB of files they will get charged for that.
I also know that Blaze plan's features are free as long as each of them (individually) stay below the limits of the free Spark plan.
So as my question says, is there a way to set limits? For example, I would like to tell Firebase to limit my cloud functions invocations to 100k per month. That way it would be free and I would never be able to get over 100k as it's limited, which means I'll never get billed for that.
Take into account that the only thing I need right now from a paid plan is the connection to external networks. I don't need anything else as we're just starting and the app is not in production, so there's no need for huge limits.
Every Firebase project is also a Google Cloud Platform project. This means that many of the advanced features of Google Cloud Platform are also available for your Firebase project.
For example, you can set up billing alert for your Firebase project, so that you are alerted when the usage reaches a certain level. While you can't configure it to switch off the project at some point, the alert should typically be quite good for alerting you to unusual usage patterns.
For more on this see:
Tracking your spending with budgets in a recent blog post.
The GCP documentation on how to set budget alerts, which is what Firebase uses under the hood.
The GCP documentation now also has a section on capping (disabling) billing to stop usage. This is a brute force approach though and may lead to data being lost, so I'd recommend investigating all other options first.
Update (December 2020): Firebase's Todd Kerpelman just released a series of videos where he disables billing using the process from the documentation mentioned above.
You cannot set spending limits to your app now.
As of December 12, 2019, you can no longer create spending limits, but
you can change or remove existing spending limits.
https://cloud.google.com/appengine/pricing#spending_limit
You can create budgets, which will alert you when reaching the budget. But it won't stop the usage when hitting the budget.
https://cloud.google.com/billing/docs/how-to/budgets#add-new-budget
The screenshot here seems to show a Spending Limit setting for Firebase projects: Firebase: Budget and Daily Spending Limit
That settings page is located here (the Spending Limit setting apparently only shows up once you set up billing for the project): https://console.cloud.google.com/appengine/settings
It's disabled in the poster's case, but I think that's only because he connected it up to a "NodeJS App Engine app", which isn't the case for many Firebase developers.
I haven't tried it yet myself, but will do so once I start a paid plan.
EDIT: Yep, the setting shows up once you switch to a paid plan. (in my case, Blaze) I don't have enough traffic yet to confirm that it works as expected, but if I find later that it doesn't, I'll give an update here.
"This example shows you how to cap costs and stops usage for a project by disabling Cloud Billing. This will cause all Google Cloud services to terminate non-free tier services for the project."
Google Cloud Source

understanding "action required" email from GCP, re: enable Cloud Build API

I use Firebase for my web apps, not Google Cloud Platform -- though I'm aware that behind the scenes, every Firebase project is also a GCP project.
I just received an email from GCP, saying (excerpted):
[Action required]: Enable the Cloud Build API for your projects before April 20, 2020, to ensure Cloud Function is built and deployed correctly ... You must enable the Cloud Build API for your project(s) to ensure your Cloud Function is built and deployed correctly. Once you enable the API, you may incur charges if your Cloud Build, Container Registry, or Cloud Storage usage exceeds the free tier limits for these products.
Does this impact the deployment or development process for Firebase at all? (e.g., right now I use firebase deploy )
As far as I can tell, the answer is no -- it just allows for a greater maximum build-time-per-day. But the email didn't mention Firebase at all, so I want to be sure I understand any other implications well before April 20.
I had the same questions and got in touch with the firebase support team, here are my questions and the answers I received:
"Is that mandatory?"
Only if you are going to deploy Cloud Functions in the future, already
deployed functions will not be affected.
"How do I know if my Cloud Build, Container Registry, or Cloud Storage usage will exceed the free tier limits for these products? is there any way how can check what I've been using so I'll be prepared?"
Cloud Build provides a free tier where only usage above 120
build-minutes/day will be charged. When your usage is within the free
tier, you will not be charged for the Cloud Build portion of Cloud
Function deployments. See Cloud Build pricing for more information.
Similarly, Cloud Storage and Container Registry share a free tier
where only usage above 5GB-months will be charged. ( * Note : free
tier only limited to US regions - US-WEST1, US-CENTRAL1, and US-EAST1
and aggregated over all 3 regions )? For example, if you have a large
deployment that uses 100GB of storage, you will only be charged an
additional $2.47 for storage/month (based on these particular U.S.
regional storage prices). You can monitor your usage and see whether
you are getting close to hitting the free quotas.
"Lastly, what does all this stuff do for my app? Why do I need to add this other features? If you were to sell me this, how would you present it for my use-case?"
This is a best effort from Google to communicate information that is
necessary to the user’s continued use of the product or that is
considered a necessary legal update and keep customers away from
having future issues. Using Cloud Build, Container Registry and Cloud
Storage provides the following benefits: Detailed function build logs
will be available in the GCP Console, aiding in debugging and
increasing visibility. The ability to get build time that exceeds the
current build quota of 120 build-mins/day. The ability to view a built
container image for your function in Container Registry.
I received the following response from Firebase Support:
You will not be able to use cloud functions if you do not enable the Cloud Build API after this date [April 20, 2020].
And, in a follow-up exchange:
as far as I know in terms of deployment everything will be the same
So, my interpretation of those responses with respect to the original question (will this affect the mechanics of development or deployment) is:
Deployment process: no change necessary
Development process: no change necessary*
*if your build time exceeds 120 minutes per day, and you wish to avoid associated charges, you could voluntarily investigate changing your deployment/development process to reduce build minutes.
Thanks also to Fran for his answer, which sheds light on other aspects of the change.

Payment SDK's with Firebase

I have never dealt with payment SDK's before. I want to implement Stripe into my app to handle in-app payments, but implementing this may take some time and quite a bit of trial and error.
The issue I am facing is that Firebase requires either the Spark or Blaze plan in order to implement these into the app. But, I do not want to pay for the plans until I am ready to fully launch my app. Is there a good way to test out payment SDK's in Firebase without paying for a plan?
I know that the Blaze plan is pay-as-you-go, but I am hesitant to get the plan now as I am sure exactly how much it would be costing me on a monthly basis while I am just testing things out.
Thanks.
You are correct in that to integrate 3rd party systems into a Firebase project you have to upgrade to a paid plan. The Blaze plan is the Flame + pay as you go. So if you are not hitting your free limits per month (which if you're the only tester, it is highly unlikely), your cost will just be the cost of the Flame plane, or $25/month (at time of writing).
To test, you can locally run your Cloud functions using the Firebase shell. That will confirm them working before you deploy to the GCP servers. Once you have your pay plan setup, just do a regular deploy and it should all work correctly. You will of course need some integration testing based on what apps you are using (web/ios/android).

Testing outbound requests from Firebase cloud functions on free tier

Each dev on our team is setting up a Firebase project to work with 'locally'. Due to the outbound requests restriction on the free tier, the implication here is that non-Google services that are being called from our functions, cannot actually be called to validate the function works as expected.
Right now the best I can come up with is determining which environment a cloud function is running in (e.g. local, master, prod, etc.) and, if not on a paid tier, fake the outbound service response.
Is there a better way to do this? Ideally we would like to be able to have a fully functional cloud function for each dev.
As you said faking the 3rd party service is one solution.
Another could be using Google's 12 month 300$ credit at https://cloud.google.com/free/
That makes it possible for you to have a single Google account with 300$ credits, then you can change your Firebase free plans into Blaze.
If needed, you can also set up budget alerts which notifies you when you spend a certain amount of credit.

Cost of developing a Google Assistant App?

What costs are involved with developing and/or releasing a Google Assistant App?
eg: Can you develop an app using DialogFlow and a backend (say Firebase) without having to pay while you learn?
First of all - you don't need to use Dialogflow or Firebase to develop your action. Both are suggested, but neither are required. You can use any NLP you want, or none at all if you use the Actions SDK (but you want an NLP). You can use any backend at all, including running it off your local machine and tunneling to it via ngrok, but you don't want to do that for production.
But, during development (and even during a light deployment before your action becomes massively popular and a stand-out hit), you have lots of solutions that will be free.
Dialogflow is free for use with the Google Assistant. Period. There is an Enterprise edition which offers additional services and support for a cost, but you won't need them. There are restrictions, but you won't bump into them until you hit 3 requests per second - which you shouldn't during development.
Firebase's free tier (the Spark Plan) is good for very simple experimentation, but once you start doing network calls to outside Google's network (if you are trying to call the network API for other services), you will be blocked. No worries! The "Blaze Plan" paid tier does require a way to bill you, but they don't start billing you until you get quite a bit of usage: 2 million function calls / month and similarly scaled usage of CPU, memory, and network. So even the "Blaze Plan" will be free during development (and for basic usage).
Updated, December 2020
Things have changed a bit since the original answer was posted, but the underlying basics remain true - there is no charge to develop for Actions on Google.
Dialogflow now has an "Essentials" edition and a more advanced "CX" edition. While you can still use both to build Actions, they're not really intended for this purpose anymore.
Instead, Google has included the Actions Builder into the Actions Console to handle the NLP work. The Actions SDK works with this, but can also just pass along all the STT information to your webhook. Both are also free to use.
Dialogflow is for free if you don't use it as an enterprise:
https://dialogflow.com/pricing/
And Firebase free tier should be enough if you not using firebase
already for other projects. enter link description here
But of course you have to calculate your own time so in case of the
spent time probably not.
For everything else yes it is, as long as you not using it already somewhere. You can for development also host your server local and use an ngrok tunnel as sever address for Dialogflow.
As an addition to shortQuestion's answer:
The free plan in Firebase should be enough if you're just using it for learning and developing apps for personal use. If you want to go a bit further you'll need to upgrade the plan.
You can sign up with a free trial for actions on Google to get 300$ of credits during a 12 month period which would be more than enough to do anything you want.
The costs of Firebase/Actions on Google on a higher plan aren't anything to worry about though, you'd be talking about a few cent per multiple hundred thousand requests.

Resources