Skip to content

Generated client code fails with "unknown service" error #7

Open
@galaxie

Description

@galaxie

I was trying to generate ETCD3 client using the specification attached and Erlang/OTP 20 on MacOS High Sierra.

Generated code fails with unknown service error.

Here is the scenario.
Protobuff specification resides in ./proto dir:

.
├── proto
│   ├── etcd_auth.txt
│   ├── etcd_kv.txt
│   └── etcd_rpc.txt
├── src
    ├── ...
├── Makefile
├── ...

I generated code using the following command:

% ProtoDir = "absolute path to proto dir".

grpc_client:compile(
        filename:join(ProtoDir, "etcd_rpc.txt"),
        [
            {i, ProtoDir},
            {use_packages, true}
        ]
    ).
ok

Then I put all two generated files (etcd_rpc_client.erl and etcd_rpc.erl) in ./src dir of my project and try to run the code:

{ok, Connection} = grpc_client:connect(tcp, "localhost", 2379).
etcd_rpc_client:'Put'(Connection, #{key => "foo", value => "bar"}, []).
{error,#{error_type => grpc,grpc_status => 12,headers => #{},
         http_status => 200,result => #{},
         status_message =>
             <<"unknown service etcdserverpb.etcdserverpb.KV">>,
         trailers =>
             #{<<":status">> => <<"200">>,
               <<"content-type">> => <<"application/grpc">>,
               <<"grpc-message">> =>
                   <<"unknown service etcdserverpb.etcdserverpb.KV">>,
               <<"grpc-status">> => <<"12">>}}}

etcd_rpc.txt
etcd_auth.txt
etcd_kv.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions