I have the following Google Cloud call:
var builder = new TextToSpeechClientBuilder();
builder.JsonCredentials = @"...";
var client = builder.Build();
var data = client.SynthesizeSpeech(new SynthesisInput { Ssml = text },
new VoiceSelectionParams { LanguageCode = culture.TwoLetterISOLanguageName },
new AudioConfig { AudioEncoding = AudioEncoding.Linear16, SampleRateHertz = 8000 }).AudioContent;
It throws the following exception:
Grpc.Core.RpcException: 'Status(StatusCode="ResourceExhausted", Detail="Received message larger than max (4675411 vs. 4194304)")'
The request is less than 2000 bytes, so it seems that the response is too big. The server wants to send the response, but the client can't accept it. How to increase this limit?
UPDATE: Since version 2.2.0 it is possible to set the max response size:
var channelOptions = GrpcChannelOptions.Empty
.WithKeepAliveTime(TimeSpan.FromMinutes(1))
.WithEnableServiceConfigResolution(false)
.WithMaxReceiveMessageSize(1024 * 1024 * 1024);
var builder = new TextToSpeechClientBuilder();
builder.JsonCredentials = jsonCredentials;
builder.GrpcChannelOptions = channelOptions;