diff --git a/src/Momento.Sdk/Internal/AuthGrpcManager.cs b/src/Momento.Sdk/Internal/AuthGrpcManager.cs index 854c874e..623a2983 100644 --- a/src/Momento.Sdk/Internal/AuthGrpcManager.cs +++ b/src/Momento.Sdk/Internal/AuthGrpcManager.cs @@ -74,6 +74,9 @@ public AuthGrpcManager(IAuthConfiguration config, string authToken, string endpo } channelOptions.Credentials = ChannelCredentials.SecureSsl; + channelOptions.MaxReceiveMessageSize = Internal.Utils.DEFAULT_MAX_MESSAGE_SIZE; + channelOptions.MaxSendMessageSize = Internal.Utils.DEFAULT_MAX_MESSAGE_SIZE; + #if USE_GRPC_WEB channelOptions.HttpHandler = new GrpcWebHandler(new HttpClientHandler()); #endif diff --git a/src/Momento.Sdk/Internal/ControlGrpcManager.cs b/src/Momento.Sdk/Internal/ControlGrpcManager.cs index bbcac40d..7a1bdbfd 100644 --- a/src/Momento.Sdk/Internal/ControlGrpcManager.cs +++ b/src/Momento.Sdk/Internal/ControlGrpcManager.cs @@ -96,8 +96,10 @@ public ControlGrpcManager(ILoggerFactory loggerFactory, string authToken, string this.channel = GrpcChannel.ForAddress(uri, new GrpcChannelOptions() { Credentials = ChannelCredentials.SecureSsl, + MaxReceiveMessageSize = Internal.Utils.DEFAULT_MAX_MESSAGE_SIZE, + MaxSendMessageSize = Internal.Utils.DEFAULT_MAX_MESSAGE_SIZE, #if USE_GRPC_WEB - HttpHandler = new GrpcWebHandler(new HttpClientHandler()) + HttpHandler = new GrpcWebHandler(new HttpClientHandler()), #endif }); List
headers = new List
{ new Header(name: Header.AuthorizationKey, value: authToken), new Header(name: Header.AgentKey, value: version), new Header(name: Header.RuntimeVersionKey, value: runtimeVersion) }; diff --git a/src/Momento.Sdk/Internal/DataGrpcManager.cs b/src/Momento.Sdk/Internal/DataGrpcManager.cs index 06d3eeff..5f7444ef 100644 --- a/src/Momento.Sdk/Internal/DataGrpcManager.cs +++ b/src/Momento.Sdk/Internal/DataGrpcManager.cs @@ -280,6 +280,9 @@ internal DataGrpcManager(IConfiguration config, string authToken, string endpoin channelOptions.LoggerFactory = config.LoggerFactory; } channelOptions.Credentials = ChannelCredentials.SecureSsl; + channelOptions.MaxReceiveMessageSize = Internal.Utils.DEFAULT_MAX_MESSAGE_SIZE; + channelOptions.MaxSendMessageSize = Internal.Utils.DEFAULT_MAX_MESSAGE_SIZE; + #if USE_GRPC_WEB channelOptions.HttpHandler = new GrpcWebHandler(new HttpClientHandler()); #endif diff --git a/src/Momento.Sdk/Internal/TopicGrpcManager.cs b/src/Momento.Sdk/Internal/TopicGrpcManager.cs index bd34c4e6..f2753af5 100644 --- a/src/Momento.Sdk/Internal/TopicGrpcManager.cs +++ b/src/Momento.Sdk/Internal/TopicGrpcManager.cs @@ -100,6 +100,9 @@ internal TopicGrpcManager(ITopicConfiguration config, string authToken, string e } channelOptions.Credentials = ChannelCredentials.SecureSsl; + channelOptions.MaxReceiveMessageSize = Internal.Utils.DEFAULT_MAX_MESSAGE_SIZE; + channelOptions.MaxSendMessageSize = Internal.Utils.DEFAULT_MAX_MESSAGE_SIZE; + #if USE_GRPC_WEB channelOptions.HttpHandler = new GrpcWebHandler(new HttpClientHandler()); #endif diff --git a/src/Momento.Sdk/Internal/Utils.cs b/src/Momento.Sdk/Internal/Utils.cs index 664e8cad..c40ad355 100644 --- a/src/Momento.Sdk/Internal/Utils.cs +++ b/src/Momento.Sdk/Internal/Utils.cs @@ -13,6 +13,11 @@ namespace Momento.Sdk.Internal; /// public static class Utils { + /// + /// The default value for max_send_message_length is 4mb. We need to increase this to 5mb in order to support cases where users have requested a limit increase up to our maximum item size of 5mb. + /// + public const int DEFAULT_MAX_MESSAGE_SIZE = 5_243_000; + /// /// Convert a UTF-8 encoded string to a byte array. /// diff --git a/src/Momento.Sdk/Internal/VectorIndexControlGrpcManager.cs b/src/Momento.Sdk/Internal/VectorIndexControlGrpcManager.cs index 30506154..c7dbb7ae 100644 --- a/src/Momento.Sdk/Internal/VectorIndexControlGrpcManager.cs +++ b/src/Momento.Sdk/Internal/VectorIndexControlGrpcManager.cs @@ -91,7 +91,9 @@ internal VectorIndexControlGrpcManager(ILoggerFactory loggerFactory, string auth var channelOptions = new GrpcChannelOptions { LoggerFactory = loggerFactory, - Credentials = ChannelCredentials.SecureSsl + Credentials = ChannelCredentials.SecureSsl, + MaxReceiveMessageSize = Internal.Utils.DEFAULT_MAX_MESSAGE_SIZE, + MaxSendMessageSize = Internal.Utils.DEFAULT_MAX_MESSAGE_SIZE, }; #if USE_GRPC_WEB channelOptions.HttpHandler = new GrpcWebHandler(new HttpClientHandler()); diff --git a/src/Momento.Sdk/Internal/VectorIndexDataGrpcManager.cs b/src/Momento.Sdk/Internal/VectorIndexDataGrpcManager.cs index ff21ceee..981ca690 100644 --- a/src/Momento.Sdk/Internal/VectorIndexDataGrpcManager.cs +++ b/src/Momento.Sdk/Internal/VectorIndexDataGrpcManager.cs @@ -118,6 +118,9 @@ internal VectorIndexDataGrpcManager(IVectorIndexConfiguration config, string aut var channelOptions = config.TransportStrategy.GrpcConfig.GrpcChannelOptions; channelOptions.LoggerFactory ??= config.LoggerFactory; channelOptions.Credentials = ChannelCredentials.SecureSsl; + channelOptions.MaxReceiveMessageSize = Internal.Utils.DEFAULT_MAX_MESSAGE_SIZE; + channelOptions.MaxSendMessageSize = Internal.Utils.DEFAULT_MAX_MESSAGE_SIZE; + #if USE_GRPC_WEB channelOptions.HttpHandler = new GrpcWebHandler(new HttpClientHandler()); #endif