An exception occurred while receiving a message from the server issue with dotnet core serverless instance

I am receiving the following error sometimes and there is no pattern thats followed when I observed

Backend: Dotnet Core
Driver: 2.29.0

Scenario: For Read, Create, Update and Delete

Error: An exception occurred while receiving a message from the server. | Source: MongoDB.Driver.Core | API: PUT /api/taxItem/update | StackTrace: at MongoDB.Driver.Core.Connections.BinaryConnection.ReceiveBufferAsync(CancellationToken cancellationToken)
at MongoDB.Driver.Core.Connections.BinaryConnection.ReceiveBufferAsync(Int32 responseTo, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Connections.BinaryConnection.ReceiveBufferAsync(Int32 responseTo, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Connections.BinaryConnection.ReceiveMessageAsync(Int32 responseTo, IMessageEncoderSelector encoderSelector, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)
at MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.PooledConnection.ReceiveMessageAsync(Int32 responseTo, IMessageEncoderSelector encoderSelector, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)
at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol1.SendMessageAndProcessResponseAsync(CommandRequestMessage message, Int32 responseTo, IConnection connection, CancellationToken cancellationToken) at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol1.ExecuteAsync(IConnection connection, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Servers.Server.ServerChannel.ExecuteProtocolAsync[TResult](IWireProtocol1 protocol, ICoreSession session, CancellationToken cancellationToken) at MongoDB.Driver.Core.Operations.RetryableReadOperationExecutor.ExecuteAsync[TResult](IRetryableReadOperation1 operation, RetryableReadContext context, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Operations.ReadCommandOperation1.ExecuteAsync(RetryableReadContext context, CancellationToken cancellationToken) at MongoDB.Driver.Core.Operations.FindOperation1.ExecuteAsync(RetryableReadContext context, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Operations.FindOperation1.ExecuteAsync(IReadBinding binding, CancellationToken cancellationToken) at MongoDB.Driver.OperationExecutor.ExecuteReadOperationAsync[TResult](IReadBinding binding, IReadOperation1 operation, CancellationToken cancellationToken)
at MongoDB.Driver.MongoCollectionImpl1.ExecuteReadOperationAsync[TResult](IClientSessionHandle session, IReadOperation1 operation, ReadPreference readPreference, CancellationToken cancellationToken)
at MongoDB.Driver.MongoCollectionImpl1.UsingImplicitSessionAsync[TResult](Func2 funcAsync, CancellationToken cancellationToken)
at MongoDB.Driver.IAsyncCursorSourceExtensions.FirstOrDefaultAsync[TDocument](IAsyncCursorSource1 source, CancellationToken cancellationToken) at MegApi.Services.QueryUtilsService.FindOne[T](IMongoCollection1 collection, Expression`1 additionalCondition, String message) in /App/MegApi/Services/QueryUtilsService.cs:line 17
at MegApi.Services.UserService.GetById(String userId, String message) in /App/MegApi/Services/UserService.cs:line 94
at MegApi.Middlewares.AuthMiddleware.InvokeAsync(HttpContext context) in /App/MegApi/Middlewares/AuthMiddleware.cs:line 54
at MegApi.Middlewares.ErrorHandlingMiddleware.InvokeAsync(HttpContext context) in /App/MegApi/Middlewares/ErrorHandlingMiddleware.cs:line 16

Hi, @Gvs_Akhil,

Welcome to the MongoDB Community Forums. Reviewing the provided stack trace, there is an error reading data from the network socket. This is likely due to a network error. We suggest reviewing network diagnostics to help pinpoint the source of the problem.

Sincerely,
James