Skip to content

Conflicting gRPC Response #168

Closed
@michaelharrigan

Description

@michaelharrigan
  • Searched the repo's previous issues for similar reports.
  • Searched the internet for any similar reports.

Issue Summary

I am encountering an unusual issue with the response object for a gRPC message. While the statusCode indicates ok and result returns success, the headers provide contradictory information. Specifically, the headers contain a status code of 2, and the grpc-message reports an error.

This conflicting information is making it challenging to determine whether an operation was successful or not.

Detailed Description

I've confirmed that this issue originates from the client side by using Postman to access the same endpoint, which returns the correct information.

iOS Response:

In the iOS response, the following points illustrate the inconsistency:

  1. The status code is displayed as ok/0.
  2. The headers show a statusCode of 2/unknown error.
  3. The grpc-message in the headers also reports an error.

CleanShot 2023-09-13 at 15 22 30@2x

Postman Response:

Contrastingly, when using Postman, I receive the correct response with no contradictory information.

CleanShot 2023-09-13 at 15 28 31@2x

Possible Cause

Through my investigation, I believe I've identified a potential cause of this issue. In the ProtocolClient, specifically in the unary(path:request:headers:completion:) function, the onResponse block checks response.code != .ok to throw an error. However, in this case, response.code is 0, while the headers indicate 2. Consequently, success is returned instead of raising a ConnectError with .failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions