Git Product home page Git Product logo

Comments (8)

haikalpribadi avatar haikalpribadi commented on August 18, 2024

I've added verbose = 3 to node_grpc_compile, and it just dumps out lots of lines of file paths, but no useful information on where it breaks, unfortunately. You can find the output here: https://pastebin.com/cX4FWUp5

from rules_proto.

promiseofcake avatar promiseofcake commented on August 18, 2024

It could have something to do with your proto layout, try to follow the Bazel proto_library best practices and see if that helps: https://blog.bazel.build/2017/02/27/protocol-buffers.html

from rules_proto.

haikalpribadi avatar haikalpribadi commented on August 18, 2024

do you mean that I shouldn't use srcs = glob(["proto/*.proto"]) in proto_library and split the rules per proto file, @promiseofcake?

from rules_proto.

promiseofcake avatar promiseofcake commented on August 18, 2024

Correct, or at least begin by placing the BUILD file in the directory with the protos. We have historically ran into issues with node proto paths by using a non-optimal layout.

from rules_proto.

pcj avatar pcj commented on August 18, 2024

Agreed definitely an anti-pattern to glob protos into one rule. Ideally one proto file per proto-library. I prefer each in own subdirectory with one proto file and one BUILD.bazel file.

from rules_proto.

haikalpribadi avatar haikalpribadi commented on August 18, 2024

Amazing - it worked! I removed the srcs = glob(["proto/*.proto"]) in proto_library, and made a proto_library rule for each proto file, all the <lang>_grpc_compile works now!

Thank you, @promiseofcake and @pcj ! :)

(I do have a different issue now, but I'll post that separately).

from rules_proto.

haikalpribadi avatar haikalpribadi commented on August 18, 2024

Hi @pcj and @promiseofcake , sorry for reopening this issue. I've tried following the best practice blog you linked.

I've declared the proto_librarys to be:

proto_library(
    name = "concept-proto",
    srcs = ["Concept.proto"],
)
proto_library(
    name = "answer-proto",
    srcs = ["Answer.proto"],
    deps = [":concept-proto"],
)
proto_library(
    name = "session-proto",
    srcs = ["Session.proto"],
    deps = [":concept-proto", ":answer-proto"],
)

And when I declare the java_grpc_library like this (as recommended by the blog):

java_grpc_compile(
    name = "client-java-proto",
    deps = ["//protocol/session:session-proto"],
)

Dependants of :client-java-proto complains for not being able to find the GRPC-generated files for Answer.proto and Concept.proto. So I added them to the java_grpc_library like the following:

java_grpc_compile(
    name = "client-java-proto",
    deps = [
        "//protocol/session:session-proto",
        "//protocol/session:answer-proto",
        "//protocol/session:concept-proto",
    ]
)

And then everything works for Java - good.

However, when I try to do the same for node_grpc_compile:

node_grpc_compile(
    name = "client-node-proto",
    deps = [
        "//protocol/session:session-proto",
        "//protocol/session:answer-proto",
        "//protocol/session:concept-proto",
    ]
)

bazel build //protocol:client-node-proto fails with error message:

ERROR: /protocol/BUILD:47:1: output 'protocol/client-node-proto/protocol/session/Answer_grpc_pb.js' was not created
ERROR: /protocol/BUILD:47:1: output 'protocol/client-node-proto/protocol/session/Concept_grpc_pb.js' was not created
ERROR: /protocol/BUILD:47:1: not all outputs were created or valid

I even try to just compile node_grpc_library for Concept.proto:

node_grpc_compile(
    name = "client-node-proto",
    deps = ["//protocol/session:concept-proto"]
)

And it also fails!

ERROR: /protocol/BUILD:47:1: output 'protocol/client-node-proto/protocol/session/Concept_grpc_pb.js' was not created
ERROR: /protocol/BUILD:47:1: not all outputs were created or valid

Doing verbose = 3 and --verbose_failures does not produce any useful information than just a list of files, which you can see the console output here: https://pastebin.com/DMpSpiMu

I've narrowed it down to the fact that Concept.proto does not have a service declared in the proto file (which is by design).

Can you help figure out what's going on and if I'm doing something wrong?

I've pushed to code onto haikalpribadi/grakn branch bazel-init-node-grpc-compile-fails. You can reproduce the problem by running bazel buid //protocol:client-node-proto.

Thank you so much!

from rules_proto.

promiseofcake avatar promiseofcake commented on August 18, 2024

I think this is an underlying problem with the node plugin for gRPC, see this issue we opened: grpc/grpc#10646

from rules_proto.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.