Firebase "Invalid argument ... rules" in CI
The rules deploy request was accepted for auth but rejected as an invalid argument. The rules reference a resource that does not exist, or the request targets a service that is not enabled on the project.
What this error means
A rules deploy fails with "Error: HTTP Error: 400, Invalid argument" referencing the ruleset or a missing database or storage bucket.
Error: HTTP Error: 400, Invalid argument. Request contains an invalid argument.Common causes
The target resource does not exist
Deploying Firestore or Storage rules to a project without a database or default bucket provisioned yields a 400.
The ruleset references an unavailable service
Rules for a product that is not enabled on the project are rejected as an invalid argument.
How to fix it
Provision the resource first
- Create the Firestore database or Storage bucket the rules target.
- Confirm the product is enabled in the console.
- Re-run the rules deploy.
firebase deploy --only firestore:rules,storage --project my-projectDeploy with --debug to see the argument
The debug output identifies which argument the API rejected, so you can correct the config.
firebase deploy --only firestore:rules --project my-project --debugHow to prevent it
- Provision databases and buckets before deploying their rules.
- Enable each product on the project before deploying its rules.
- Use
--debugto pinpoint an invalid argument quickly.