Skip to content
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

RpcError: missing trailers when empty response #330

Closed
eKazim opened this issue Jun 10, 2022 · 0 comments · Fixed by #331
Closed

RpcError: missing trailers when empty response #330

eKazim opened this issue Jun 10, 2022 · 0 comments · Fixed by #331

Comments

@eKazim
Copy link
Contributor

eKazim commented Jun 10, 2022

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.

eKazim added a commit to eKazim/protobuf-ts that referenced this issue Jun 12, 2022
Fixed grpcweb-transport to handle responses with empty body and status header.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant