protojure/protoc-plugin

Problem to generated proto when has java_package on proto files.

matheusfrancisco opened this issue · 3 comments

Hi, i'm having a problem with Clojure as a server and Golang as a client.
When my proto file contains the following lines:

syntax = "proto3";
package service.example.client;
option java_package = "br.com.service.example.client";

When we generate the server code, the generated code namespaces follows the java_package option, as expected.
However, the Golang client generated code doesn't follow the java_package naming convention, and instead, it tries to reach for methods declared on package service.example.client;

Because there's no namespaces declared as described above, the client fails to communicate with the server, and tells us that it couldn't find the implementation of the requested method.

To reproduce the problem, just follow the instructions on this repo: https://github.com/matheusfrancisco/issue-protoc-protojure-grpc

Would I like to know if his a bug on protojure side, if that's the case. I would like to help open a Pull Request as soon as possible?

the option pragmas should not impact the wire abi and thus the :pkg. If that is indeed the case, that is a bug. The only thing that should be impacted by the java_package field is the clojure namespaces.

the option pragmas should not impact the wire abi and thus the :pkg. If that is indeed the case, that is a bug. The only thing that should be impacted by the java_package field is the clojure namespaces.

when I generated using java_package

(def ^:const rpc-metadata
  [{:pkg "br.com.service.example.client" 
    :service "Example"
    :method "Authenticate"
    :method-fn Authenticate-dispatch 
    :server-streaming false 
    :client-streaming false 
    :input pb->AuthRequest
    :output new-AuthResponse}])

when the client invoke err := c.cc.Invoke(ctx, "/service.example.client.Example/Authenticate", in, out, opts...) and I've received this error
rpc error: code = Unimplemented desc = Not Found: HTTP status code 404; transport: missing content-type field

and when we comment and generated without java_package the rpc-metadata is and when I invoke from go client it works!

(def ^:const rpc-metadata
  [{:pkg "service.example.client"
    :service "Example" 
    :method "Authenticate" 
    :method-fn Authenticate-dispatch 
    :server-streaming false
    :client-streaming false
    :input pb->AuthRequest 
    :output new-AuthResponse}]) 

if you know where I can start debugging to fix this bug, please let me know ?

Hi @ghaskins, I came across this issue with generated client code talking to a grpc-c++ server. The server kept responding with gRPC error 12 (Unimplemented) until I was able to debug it by looking at the HTTP headers. I have reproduced it with a new test case in #64