Firebase Extension

Stop Firebase spending at the budget you set.

When your project's cost reaches a budget threshold you define, Auto Stop Services removes the billing account, which suspends paid services. Cloud billing alerts notify you but take no action on their own. Your data is preserved, and you restore service by reconnecting billing.

Version 2.0.0 License Apache-2.0 Runtime Node.js 22 Source open source
01 / How it works

The flow.

You set a dollar budget and a stop threshold (default 100%). Google Cloud tracks the spend; the extension takes the action when the threshold is reached.

push subscribe act Billing alert Pub/Sub ( ) Function Billing API Removes the billing account from the project
01

Budget alert

Your Cloud Billing budget fires an alert as spend crosses each threshold.

02

Pub/Sub

The alert lands on a topic the extension creates when you install it.

03

The function checks

A Cloud Function compares the alert to your stop threshold. Below it, nothing happens.

04

Billing removed

At or above it, the billing account is detached and paid services stop.

02 / Why it exists

Alerts notify, they don't act.

Firebase billing is usage based, so a bug such as a recursive function or a missing auth check, or outright abuse, can increase spend quickly. Google's budget alerts email you when a threshold is crossed, but they do not stop anything on their own (large unexpected bills are a documented risk).

This extension provides the missing step: it removes the billing account when your threshold is reached. Your data is preserved (storage, Firestore and config remain), so recovery is a matter of fixing the cause and reconnecting billing.

Note for version 2.0.0

API disablement (Strategy 2) has been removed.

Google's Service Usage API no longer disables a service that still has live resources, and there is no flag to override it:

FAILED_PRECONDITION: Resources are found when disabling service(s)... please delete the following resources first

Billing account removal was always the recommended approach and is now the only one. Full reasoning and migration notes are in the CHANGELOG. If you run 1.x with DISABLE_BILLING set to No, switch it to Yes when you update.