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
I was trying to generate ETCD3 client using the specification attached and Erlang/OTP 20 on MacOS High Sierra.
Generated code fails with
unknown serviceerror.Here is the scenario.
Protobuff specification resides in
./protodir:I generated code using the following command:
Then I put all two generated files (
etcd_rpc_client.erlandetcd_rpc.erl) in./srcdir 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