improbable-eng / grpc-web

gRPC Web implementation for Golang and TypeScript
Apache License 2.0
4.39k stars 435 forks source link

Grpc client unexpected behavior #1177

Closed dmitryshelomanov closed 11 months ago

dmitryshelomanov commented 11 months ago

Versions of relevant software used "@improbable-eng/grpc-web": "^0.15.0",

What happened Errors messages not passed to grpc client, but in network all correctly returned When backend return some error (code 9 and some message for example) Grpc client return always code 2 and message "Response closed without grpc-status (Headers only)"

What you expected to happen When network contains Grpc-Status: 9 its should be passed to grpc client

How to reproduce it (as minimally and precisely as possible): No idea

Full logs to relevant components

Client response (grpc client logs)

{
    "code": 2,
    "metadata": {
        "headersMap": {
            "content-length": [
                "0"
            ],
            "content-type": [
                "application/grpc-web+proto"
            ]
        }
    },
    "message": "Response closed without grpc-status (Headers only)"
}

Messages from network

Grpc-Message:
loyalty not applied: ACTION_INVALID_CONDITION
Grpc-Status:
9
Grpc-Status-Details-Bin:
CAkSLWxveWFsdHkgbm90IGFwcGxpZWQ6IEFDVElPTl9JTlZBTElEX0NPTkRJVElPThrUAQo5dHlwZS5nb29nbGVhcGlzLmNvbS91dHAuY29tbW9uLmVycm9yX2RldGFpbHMudjEuRXJyb3JJbmZvEpYBCilDSEVDS09VVF9FUlJPUl9SRUFTT05fTE9ZQUxUWV9OT1RfQVBQTElFRBIIY2hlY2tvdXQaXwoGc3RhdHVzElVycGMgZXJyb3I6IGNvZGUgPSBJbnZhbGlkQXJndW1lbnQgZGVzYyA9IGFjdGlvbiB3YXMgc2tpcHBlZCBkdWUgdG8gaW52YWxpZCBjb25kaXRpb25zGpkBCkB0eXBlLmdvb2dsZWFwaXMuY29tL3V0cC5jb21tb24uZXJyb3JfZGV0YWlscy52MS5Mb2NhbGl6ZWRNZXNzYWdlElUKAnJ1Ek/Rh9GC0L4t0YLQviDQv9C+0YjQu9C+INC90LUg0YLQsNC6CtC/0L7QstGC0L7RgNC40YLQtSDQv9C+0L/Ri9GC0LrRgyDQv9C+0LfQttC1
Server:
nginx/1.20.1
X-Envoy-Upstream-Service-Time:
197

Environment:

NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7"

dmitryshelomanov commented 11 months ago

header Access-Control-Expose-Headers: custom-header-1,grpc-status,grpc-message,grpc-status-details-bin

solve it