Firebase "Compilation error in firestore.rules" in CI
The rules compiler parsed firestore.rules and found a syntax or semantic error. The message names the file, line, and column so you can fix the exact statement before the deploy proceeds.
What this error means
A rules deploy fails with "Error: Compilation error in firestore.rules" and a line and column pointing at the offending rule.
Error: Compilation error in firestore.rules:
[E] 12:14 - Unexpected 'allow'. Expected '}'.Common causes
A syntax error in the rules file
A missing brace, a stray keyword, or an unmatched block makes the compiler reject the file at the named line.
An unsupported or misused rules construct
Using a function or operator incorrectly for the rules language triggers a compile error.
How to fix it
Fix the reported line and column
- Open
firestore.rulesat the line and column in the message. - Correct the syntax (close braces, fix the keyword).
- Re-run the deploy, or dry-run rules only.
firebase deploy --only firestore:rules --project my-projectValidate rules against the emulator
Run rules through the emulator so syntax errors surface before the deploy step in CI.
firebase emulators:exec --only firestore "npm test"How to prevent it
- Test rules in the emulator before deploying.
- Keep rules under review so syntax errors are caught in PRs.
- Deploy
firestore:rulesin a step that fails fast on a compile error.