Skip to content

Mismatch of method route names with grpclib server #171

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

Closed
SoerenBusse opened this issue Nov 17, 2020 · 2 comments · Fixed by #177
Closed

Mismatch of method route names with grpclib server #171

SoerenBusse opened this issue Nov 17, 2020 · 2 comments · Fixed by #177
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@SoerenBusse
Copy link

Hey there,

we're trying to use the "Betterproto" library with a grpc server based on grpclib. However the generated routes in the stub file of betterproto doesn't match the routes in the service from grpclib, which results in a very vacuous error message, so the method call will fail:

Betterproto:

return await self._unary_unary(
    "/.Frontend/SampleMethod", request, SampleMethodReply
)

grpclib:

return {
            '/Frontend/SampleMethod': grpclib.const.Handler(
                ...
            )
}

Why does betterproto generate different route-names than grpclib? Is there a specification for naming the route-names?

I think the error is comming from here:
https://github.com/danielgtaylor/python-betterproto/blob/master/src/betterproto/plugin/models.py#L641
Is there a check missing which replaces a dot with an empty string?

We're generating the proto files using the following command:
python3 -m grpc_tools.protoc -I grpc-interface-definitions/proto/ --python_betterproto_out=lib/grpc-interface_definitions grpc-interface-definitions/proto/*


The vacuous error message we got from betterproto is the following one:

GRPCError(<Status.UNKNOWN: 2>, 'Missing content-type header', None)

Debugging the server shows that the request is canceled due to a not found method name. It sends a Status.UNIMPLEMENTED error back to the client, which seems to have an issue parsing these early errors. I think this error message might be related to a bug in the underlying grpclib and isn't directly associated to betterproto. However I will mention it here if anybody is searching for this error message like me a few hours ago ;)

@SoerenBusse SoerenBusse changed the title Match method routes with grpclib server mismatch of method route names with grpclib server Nov 17, 2020
@SoerenBusse SoerenBusse changed the title mismatch of method route names with grpclib server Mismatch of method route names with grpclib server Nov 17, 2020
@w4rum
Copy link
Contributor

w4rum commented Nov 21, 2020

I came across the same issue when using the Node.js gRPC library together with betterproto. Unfortunately, I haven't found any specification for route names either.

You might be able to work around this problem by using package names in your protobuf source files.

@nat-n
Copy link
Collaborator

nat-n commented Nov 25, 2020

This should do the trick #177

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
3 participants