File Attachment gives error in private endpoint enabled bot
Version
4.12.0
Bot Composer Versions:
Version: 2.1.3-nightly.364675.1a93f21 Electron: 14.2.6 Chrome: 93.0.4577.82 NodeJS: 14.17.0 V8: 9.3.345.20-electron.0
Describe the bug
Getting below error in bot when attachment is uploaded Error getting value from 'ReadTimeout' on 'System.IO.MemoryStream'
To Reproduce
Steps to reproduce the behavior:
- Make sure private endpoint is enabled in Bot Service
- Add file attachment dialogs
- Run the webchat sample code with createDirectLineAppServiceExtension
- Upload any file - You will see Error getting value from 'ReadTimeout' on 'System.IO.MemoryStream'
Expected behavior
File should be attached successfully
Screenshots
Additional Error
Getting below error in Azure App Service Logs kudu logs
[OnTurnError] unhandled error : Error getting value from 'ReadTimeout' on 'System.IO.MemoryStream'.
Exception: Newtonsoft.Json.JsonSerializationException: Error getting value from 'ReadTimeout' on 'System.IO.MemoryStream'. ---> System.InvalidOperationException: Timeouts are not supported on this stream. at System.IO.Stream.get_ReadTimeout() at lambda_method(Closure , Object ) at Newtonsoft.Json.Serialization.ExpressionValueProvider.GetValue(Object target) --- End of inner exception stack trace --- at Newtonsoft.Json.Serialization.ExpressionValueProvider.GetValue(Object target) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer) at Microsoft.Bot.Builder.Dialogs.ObjectPath.GetNormalizedValue(Object value, Boolean json) at Microsoft.Bot.Builder.Dialogs.ObjectPath.SetObjectSegment(Object obj, Object segment, Object value, Boolean json) at Microsoft.Bot.Builder.Dialogs.ObjectPath.SetPathValue(Object obj, String path, Object value, Boolean json) at Microsoft.Bot.Builder.Dialogs.DialogSet.CreateContextAsync(ITurnContext turnContext, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.DialogExtensions.RunAsync(Dialog dialog, ITurnContext turnContext, IStatePropertyAccessor`1 accessor, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.Adaptive.AdaptiveDialogBot.OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken) at Microsoft.Bot.Builder.SetSpeakMiddleware.OnTurnAsync(ITurnContext turnContext, NextDelegate next, CancellationToken cancellationToken) at Microsoft.Bot.Builder.ShowTypingMiddleware.OnTurnAsync(ITurnContext turnContext, NextDelegate next, CancellationToken cancellationToken) at Microsoft.Bot.Builder.MiddlewareSet.ReceiveActivityWithStatusAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken) at Microsoft.Bot.Builder.BotAdapter.RunPipelineAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken) Failed to read frame from transport.
Exception: System.IO.InvalidDataException: header type delimeter is malformed at Microsoft.Bot.Streaming.Payloads.HeaderSerializer.Deserialize(Byte[] buffer, Int32 offset, Int32 count) at Microsoft.Bot.Connector.Streaming.Transport.TransportHandler.TryParseHeader(ReadOnlySequence`1& buffer, Header& header) at Microsoft.Bot.Connector.Streaming.Transport.TransportHandler.ListenAsync(CancellationToken cancellationToken)