1.2.0 • Published 3 years ago

firebase-billing-limiter v1.2.0

Weekly downloads
15
License
MIT
Repository
github
Last release
3 years ago

firebase-billing-limiter

Automatically disable billing for firebase projects that surpass a certain amount

Install

Run npm i firebase-billing-limiter or yarn add firebase-billing-limiter

Configuration

Billing Member Role

Access your GCP console, in the Billing tab it's necessary to go to "Account Management". Make sure that the selected billing account is the billing used on the Firebase project you want to use this package.

npm.io

Next, it's necessary to give a member role to your cloud function's service account. The next image shows the location of the service account.

npm.io npm.io npm.io

Billing API

You also need to enable the GCP's Cloud Billing API npm.io

Project Quotas

Finally, it's necessary to set some billing usage quotas, The billing will only be disabled, if the value you set for a quota it's the same as provided on the disableProjectAmount property. Also, it's necessary to create a topic on this budget. Make sure the quota is assigned to the desired project only. The Topic ID will later be passed as a property topicId. npm.io

In the image's case, I can assign 5, 9 or 10 to the disableProjectAmount property.

Usage

On the index.[ts|js] add the following cloud function:

import BillingLimiter from "firebase-billing-limiter";

exports.BillingLimiter = BillingLimiter({
  disableProjectAmount: 10.0, // The amount that will trigger the disabling (in your project billing currency).
  topicId: "billing", // The topicid created on the quotas.
});
1.2.0

3 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago