-
Notifications
You must be signed in to change notification settings - Fork 900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firestore emulator doesn't recognise rules flag #1303
Comments
That's a good point and it's a documentation error. The firestore emulator
automatically uses the rules file specified in your firebase.json , are you
trying to use a different file?
…On Thu, May 16, 2019, 8:22 AM Yuri ***@***.***> wrote:
[REQUIRED] Environment info
*firebase-tools: 6.9.2*
*Platform: macOS*
[REQUIRED] Test case
According to docs
The emulator supports an optional --rules CLI flag. It expects the name of
a local file containing your Cloud Firestore Security Rules and applies
those rules to all projects. If you don't provide the local file path or
use the loadFirestoreRules method as described below, the emulator treats
all projects as having open rules.
[REQUIRED] Steps to reproduce
firestore (master) $ firebase emulators:start --only firestore --rules
firestore.stable.rules
[REQUIRED] Expected behavior
--rules flag to be recognised as per Documentation
[REQUIRED] Actual behavior
error: unknown option --rules'`
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1303?email_source=notifications&email_token=ACATB2VTKNWV6JWVGUE2IKTPVV33VA5CNFSM4HNNVHKKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GUGOD4A>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACATB2RWZQBJLLQ5WRRA2TTPVV33VANCNFSM4HNNVHKA>
.
|
This is definitely a documentation error, I believe we're having some conversations about docs today so I'll make sure to bring this up as a point of confusion! |
Yes I tried 3 different ways: 1
in firebase.json which also doesn't work It always just use default one from this
|
So I guess it now turned into a feature request |
@Yuripetusko yeah this is a FR not a bug since right now we only look for what's in Could you explain your use case a bit more? What is the meaning of |
@samtstern I guess it's not a big deal, just for few days we had multiple generated rules as we were testing some security rules and didn't want to deploy them straight away but wanted to use them in our jest tests |
@Yuripetusko FYI we provide a way to load rules files from inside your tests using the That's probably your best bet if you want to use a different rule set only in tests. |
@samtstern I actually already do this, but it doesn't work, looks like emulator still overwrites rules that it finds in firebase.json |
That's surprising, could you provide a snippet showing how you're using the |
this is how I do it
And I am sure that file is loaded as if I change path it complains that fs cannot find a file And I am sure that setup is called as auth user is set exactly as in setup function |
The only thing I do differently is I don't use firebase/testing asserts, and use jest instead, but setup is using firebase/test.. |
That code looks correct, and when I try it it works. Can you provide a short repro of the issue you're running into (i.e., your rules, a test script, and the command you use to execute them)? |
@ryanpbrewster Indeed while I was creating a reproducible repository this morning it worked using |
@Yuripetusko thanks for following up! |
@abeisgoat Could this be reopened since the documentation is still incorrect? https://firebase.google.com/docs/firestore/security/test-rules-emulator#before_you_run_the_emulator |
@therefromhere good call, I will have to get those docs fixed. |
@samtstern It would be good to add a configuration schema for the |
@therefromhere I have submitted a docs change, it will go live probably tomorrow. |
[REQUIRED] Environment info
firebase-tools: 6.9.2
Platform: macOS
[REQUIRED] Test case
According to docs
The emulator supports an optional --rules CLI flag. It expects the name of a local file containing your Cloud Firestore Security Rules and applies those rules to all projects. If you don't provide the local file path or use the loadFirestoreRules method as described below, the emulator treats all projects as having open rules.
[REQUIRED] Steps to reproduce
firestore (master) $ firebase emulators:start --only firestore --rules firestore.stable.rules
[REQUIRED] Expected behavior
--rules
flag to be recognised as per Documentation[REQUIRED] Actual behavior
error: unknown option
--rules'`The text was updated successfully, but these errors were encountered: