Grpc.Net.Client.Web: Request with RepeatedField Throws InvalidOperationException when GrpcWebText Mode is set
See original GitHub issueHello,
I’m trying out the experimental Grpc-Web functionality. On the client side, in Startup.cs, I have:
var handler = new GrpcWebHandler(GrpcWebMode.GrpcWebText, new HttpClientHandler());
return new TheBook.TheBookClient(GrpcChannel.ForAddress(":url-to-service:"), new GrpcChannelOptions
{
HttpClient = new HttpClient(handler)
}));
The request I’m sending looks like this (Value is string; the Carriers property is Google.Protobuf.Collections.RepeatedField<string>):
var getLibraryRequest = new GetLibraryRequest() { UserId = userId, SearchTerm = SearchTerm ?? "" };
getLibraryRequest.Carriers.AddRange(userAssociations.Where(c => c.Type == "Carrier").Select(c => c.Value));
var result = await _Client.GetLibraryAsync(getLibraryRequest);
This throws on the client side. After enabling Grpc: Debug in the Logging section in appsettings.json, this is revealed:
Exception thrown: 'System.InvalidOperationException' in Grpc.Net.Client.Web.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in Grpc.Net.Client.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Net.Http.dll
Exception thrown: 'System.IO.IOException' in System.Net.Http.dll
Exception thrown: 'System.IO.IOException' in System.Net.Http.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.IO.IOException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Net.Http.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Net.Http.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Net.Http.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in Grpc.Net.Client.dll
Exception thrown: 'Grpc.Core.RpcException' in System.Private.CoreLib.dll
If I set GrpcWebMode.GrpcWeb in Startup.cs, the request sends, successfully hits the gRPC service, and completes successfully.
Is GrpcWebText to only be used in situations where you do not need a repeated field? Is there a misunderstanding on my side?
Thank you, Joseph A. Pietrzak, Jr.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
c# - .NET 5 GRPC client call throws exception: Requesting ...
My company proxy appears to be interfering with HTTP/2 (unsupported?), preventing gRPC from working correctly. The workaround for local ...
Read more >Troubleshoot gRPC on .NET
NET Core client. The .NET gRPC client can call insecure gRPC services by specifing http in the server address. For example, GrpcChannel.
Read more >Grpc.Net.Client.Web 2.55.0
GrpcWebMode.GrpcWebText configures content to be base64 encoded. Required for server streaming calls in browsers. HttpVersion: HTTP protocol Version used to set ...
Read more >ServiceStack gRPC
Requests are executed using the RpcGateway which provides a pure object model for executing the full HTTP Request pipeline which returns the Response...
Read more >Introduction to gRPC in .NET Core and .NET 5
gRPC is a high-performance RPC framework with pluggable authentication and load balancing features. In this post, you will learn about gRPC ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Lets close it
James,
Okay thank you for the acknowledgement and clarification. I have been using GrpcWeb mode and it handles those large requests well and has been working well in general.
Should I leave this Issue open for your process? Or close it since you have answered my questions?