grpc-web icon indicating copy to clipboard operation
grpc-web copied to clipboard

Grpc-web not return exactly grpc status always response 2 Incomplete response

Open KP-story opened this issue 2 years ago • 4 comments

I gen code using a command protoc -I=./src/proto
--js_out=import_style=commonjs,binary:./src/generated
--grpc-web_out=import_style=typescript,mode=grpcweb:./src/generated
$(find ./src/proto -iname "*.proto") When I sent request that was not valid, Grpc web always response 2 incomplete response , even though my response headers contained the 'grpc-status' and 'grpc-message' fields." Screenshot 2024-03-29 at 23 37 12

KP-story avatar Mar 29 '24 16:03 KP-story

@KP-story Thanks for the report!

Do you mind following this following Typescript example, and check how things are looking different between that and what you have? https://github.com/grpc/grpc-web/blob/master/net/grpc/gateway/examples/echo/ts-example/README.md

Without knowing your whole setup, it's hard to know what's wrong. So it would be easier if you compare the wire data against the demo we have.

sampajano avatar Mar 29 '24 22:03 sampajano

@KP-story Thanks for the report!

Do you mind following this following Typescript example, and check how things are looking different between that and what you have? https://github.com/grpc/grpc-web/blob/master/net/grpc/gateway/examples/echo/ts-example/README.md

Without knowing your whole setup, it's hard to know what's wrong. So it would be easier if you compare the wire data against the demo we have.

HI, My backend was written by rust tonic web. I always response null with grpc-status and grpc-message in metadata. Is it valid ?

KP-story avatar Mar 30 '24 15:03 KP-story

@KP-story As I see you are using CloudFlare might I recommend checking if you have access to the CloudFlare Dashboard for that website, go to the Network tab, and scroll to the bottom and make sure gRPC is enabled so it knows to proxy the gRPC API connection. https://developers.cloudflare.com/network/grpc-connections/

dnprogramming avatar Mar 31 '24 19:03 dnprogramming

@KP-story As I see you are using CloudFlare might I recommend checking if you have access to the CloudFlare Dashboard for that website, go to the Network tab, and scroll to the bottom and make sure gRPC is enabled so it knows to proxy the gRPC API connection. https://developers.cloudflare.com/network/grpc-connections/

Hi, I have just updated the configuration in Cloudflare, but it's still showing an error. I wonder whether the response Content-Length being equal to zero is the cause of the error.

Screenshot 2024-04-01 at 07 55 03 Screenshot 2024-04-01 at 07 55 14

KP-story avatar Apr 01 '24 00:04 KP-story

@KP-story Same problem. Did you solve it?

yzc1114 avatar Jun 12 '24 12:06 yzc1114

Yes, I have just added "grpc-status" and "grpc-messages" to the "Access-Control-Allow-Headers" in the preflight request. Vào 19:42, Th 4, 12 thg 6, 2024 Zichao Yang @.***> đã viết:

@KP-story https://github.com/KP-story Same problem. Did you solve it?

— Reply to this email directly, view it on GitHub https://github.com/grpc/grpc-web/issues/1417#issuecomment-2162911576, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKG3VI34QQLD6QQA5JX7KJTZHA63VAVCNFSM6AAAAABFOUYXCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRSHEYTCNJXGY . You are receiving this because you were mentioned.Message ID: @.***>

KP-story avatar Jun 12 '24 14:06 KP-story

@KP-story Thanks for the update! Glad to hear that the issue is resolved now! 😃

I will close this issue now :)

sampajano avatar Jun 12 '24 17:06 sampajano