Reputation: 2549
I can't make the CLI firebase deploy rules work.
I have a file called security.rules at the root level of my firebase project directory.
In CLI, I type:
firebase deploy --only firestore:rules
Then I get this response in the CLI:
Error: Cannot understand what targets to deploy. Check that you specified valid targets if you used the --only or --except flag. Otherwise, check your firebase.json to ensure that your project is initialized for the desired features.
What I tried:
I tried going into my firebase.json and adding the rules option.
Before:
{
"functions": {
"predeploy": [
//"npm --prefix \"$RESOURCE_DIR\" run lint"
],
"source": "functions"
}
}
After:
{
"functions": {
"predeploy": [
//"npm --prefix \"$RESOURCE_DIR\" run lint"
],
"source": "functions"
},
"rules": "security.rules"
}
And I got the same problem... Any ideas?
Upvotes: 3
Views: 970
Reputation: 317828
The command is this:
firebase deploy --only firestore
Your firebase.json file should have a firestore
key at the top level, and it may contain two child properties. When you initialize a new project and activate Firestore, the firestore
key will be populated like this by default:
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
}
You can modify it if you want to use different file names.
Read the documentation for firebase.json for more detailed information.
Upvotes: 4