Skip to content

RpcError: missing trailers when empty response #330

Closed
@eKazim

Description

First of all, thanks for such a cool library! But let's make it even better :)

I have encountered the same error as in #232
But in my case, on other side grpc proxy - envoy. And previous solution that i used, grpc-web + google-porotobuf, works fine with it.
This problem occurs only when stream closed by server with empty response.
https://github.com/timostamm/protobuf-ts/blob/master/packages/grpcweb-transport/src/grpc-web-transport.ts#L120
Promise returned from function readGrpcWebResponseBody resolved without calling a callback (that handles trailers), because response.body has zero length.
According to https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md
"3. Trailers must be the last message of the response, as enforced by the implementation"
And check for trailers and status is correct. But there is pt. 4: "Trailers-only responses: no change to the gRPC protocol spec. Trailers may be sent together with response headers, with no message in the body."
So, this is normal that response body is empty and not contain trailers, if they exists in response headers.
And in my case response headers contains header: grpc-status: 0, that could be parsed correctly.

In total, we need to fix the check for trailers and status, to resolve this case.
Soon I will try to open PR to fix this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions