Skip to content

Mismatch of method route names with grpclib server #171

Closed
@SoerenBusse

Description

@SoerenBusse

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 ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions