Skip to content
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

Installation issue - firebase_rules_options.proto: File not found. #16

Closed
k0ff33 opened this issue Apr 17, 2018 · 5 comments
Closed

Installation issue - firebase_rules_options.proto: File not found. #16

k0ff33 opened this issue Apr 17, 2018 · 5 comments
Labels

Comments

@k0ff33
Copy link

k0ff33 commented Apr 17, 2018

Hey, first and foremost thanks for the tool, it makes building Firestore security rules more intuitive.

I have a slight problem with installing it correctly though. I've followed the instruction notes, installed last release version of protoc, copied content of include folder to /usr/local/include and added both protoc and plugin binary to my $PATH.

It works fine with simple examples that don't import "firebase_rules_options.proto"; (first example with proto2 syntax), however, trying something more complex with the ^ import results in:

firebase_rules_options.proto: File not found.
firestore.proto: Import "firebase_rules_options.proto" was not found or had errors.

I've tried using the --plugin=protoc-gen-firebase_rules= flag as well with no luck.
screen shot 2018-04-17 at 11 27 39

Do you have an idea what is wrong here? I guess it's more of a protobuf issue rather than plugin-related, but wanted to ask here first.

I've found a similar issue on stackoverflow but the proposed solutions didn't work either. I guess it's definitely to do with /usr/local/include not being included but I'm not a C++ user and have no idea how to fix that. Thanks.

@rockwotj
Copy link
Contributor

Protocol doesn't know where to find our specific extensions, so you need to extend the "proto path" to include the options proto, the example script does it by: https://github.com/firebase/protobuf-rules-gen/blob/7a8fde451153a2d5de6f0c2597e06faeba245604/example_usage.sh#L37

So if you are trying to import just the file, you'll need to add the directory containing the file to the proto path using the flag I pointed you too.

Let me know if that works!

@k0ff33
Copy link
Author

k0ff33 commented Apr 19, 2018

Ok, that makes sense, thanks. I ended up using two --proto_path parameters, one to a clone of this repo and one to my project as such:
protoc --firebase_rules_out=. --proto_path=/Users/kamilwojtczyk/Developer/open-source/protobuf-rules-gen/proto/ --proto_path=. firestore.proto

Now I'm getting errors about other includes, where can I get those? They don't seem to be part of protoc package.

google/protobuf/descriptor.proto: File not found.
firebase_rules_options.proto: Import "google/protobuf/descriptor.proto" was not found or had errors.
firebase_rules_options.proto:24:8: "google.protobuf.MessageOptions" is not defined.
firebase_rules_options.proto:28:8: "google.protobuf.FieldOptions" is not defined.
firebase_rules_options.proto:32:8: "google.protobuf.FileOptions" is not defined.
firebase_rules_options.proto:36:8: "google.protobuf.EnumOptions" is not defined.
firestore.proto: Import "firebase_rules_options.proto" was not found or had errors.

@rockwotj
Copy link
Contributor

https://github.com/google/protobuf/tree/master/src/google/protobuf

They are in the protobuf repo. Depending how it got installed, you may or may not have them. If you clone that repo, just add the src/ directory to the proto path.

I'm going to try to update the README to make this more clear, thanks for bring this up!

@k0ff33
Copy link
Author

k0ff33 commented Apr 19, 2018

Thanks, adding another --proto_path to protobuf/src fixes the problem.
I currently invoke protoc with 3 proto_path(s) pointing to protobuf/src, protobuf-rules-gen/proto and current working folder like:

protoc --firebase_rules_out=. --proto_path=/Users/kamilwojtczyk/Developer/open-source/protobuf/src/ --proto_path=/Users/kamilwojtczyk/Developer/open-source/protobuf-rules-gen/proto/ --proto_path=. firestore.proto

Regarding the way it was installed, I just followed the guide from repo's readme:

  1. Downloaded protobuf binary (protoc-3.5.1-osx-x86_64.zip) from releases,
  2. Followed instructions from readme.txt -> added binary to $PATH and copied 'include' directory to '/usr/local/include/'
  3. Downloaded plugin binary from releases, added to $PATH

PS. I'm looking forward to seeing timestamps in the future. Great work!

@rockwotj
Copy link
Contributor

Awesome, I'm glad that worked, I'm going to close this with the PR to update the documentation, let me know if that is sufficient!

PS. Please open another issue for timestamps and I'll get to it

rockwotj added a commit that referenced this issue Apr 19, 2018
* Mention --proto_path in the README usage

Closes #16

* Update README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants