volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

AI OnAI Off

WebSocket Error on CMS 12

Hi Folks, 
We are in the middle of ugrading a site to cms 12 and we are seeing this error a lot in our logs.  Has anyone seen this before. it's a CMS 12.28 site, dotnet 8. Hosted on Azure and using Open Id Connect to AAD for authentication if that might be relevant.
2024-04-10 10:20:15,448 [69] ERROR EPiServer.Shell.UI.Messaging.Internal.DefaultWebSocketHandler: Web socket communication failure
System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake.
   at System.Net.WebSockets.ManagedWebSocket.ThrowEOFUnexpected()
   at System.Net.WebSockets.ManagedWebSocket.EnsureBufferContainsAsync(Int32 minimumRequiredBytes, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TResult](Memory`1 payloadBuffer, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
   at System.Threading.Tasks.ValueTask`1.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state)
--- End of stack trace from previous location ---
   at EPiServer.Shell.UI.Messaging.Internal.DefaultWebSocketHandler.ProcessWebSocketRequestAsync(HttpContext context, WebSocket webSocket)
System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake.
   at System.Net.WebSockets.ManagedWebSocket.ThrowEOFUnexpected()
   at System.Net.WebSockets.ManagedWebSocket.EnsureBufferContainsAsync(Int32 minimumRequiredBytes, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TResult](Memory`1 payloadBuffer, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
   at System.Threading.Tasks.ValueTask`1.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state)
--- End of stack trace from previous location ---
   at EPiServer.Shell.UI.Messaging.Internal.DefaultWebSocketHandler.ProcessWebSocketRequestAsync(HttpContext context, WebSocket webSocket)
2024-04-10 10:20:15,459 [69] ERROR Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware: An unhandled exception has occurred while executing the request.
System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake.
   at System.Net.WebSockets.ManagedWebSocket.ThrowEOFUnexpected()
   at System.Net.WebSockets.ManagedWebSocket.EnsureBufferContainsAsync(Int32 minimumRequiredBytes, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TResult](Memory`1 payloadBuffer, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
   at System.Threading.Tasks.ValueTask`1.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state)
--- End of stack trace from previous location ---
   at EPiServer.Shell.UI.Messaging.Internal.DefaultWebSocketHandler.ProcessWebSocketRequestAsync(HttpContext context, WebSocket webSocket)
   at EPiServer.Shell.UI.Messaging.Internal.DefaultWebSocketHandler.ProcessWebSocketRequestAsync(HttpContext context, WebSocket webSocket)
   at EPiServer.Shell.Web.Mvc.ShellUIEndpointRoutingExtension.<RegisterWebSocketEndpoint>b__1_0(HttpContext context)
   at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.Invoke(HttpContext httpContext)
   at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext httpContext, Boolean retry)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
#320726
Apr 19, 2024 10:49
- Apr 22, 2024 15:57
Have you added by mistake the version "dotnet 8", because I think Optimizely CMS 12 is latest supporting to dotnet 6.0 version.

Hi Dave,

is it working fine in local environment, just on Azure throws that error?
Do you see Optimizely alert message after logged in to edit mode that Real-time updates are disabled?
Have you checked WebSocket is enabled on Azure service?

#320727
Apr 19, 2024 11:13

Hi Dave,

I think it's related to logged-in CMS users closing the browser 

This looks like it was fixed in EPiServer.CMS.UI 12.29.0. - https://world.optimizely.com/documentation/Release-Notes/ReleaseNote/?releaseNoteId=CMS-32095 

#320860
Edited, Apr 22, 2024 9:12

Hi Dave,

You are using DotNet 8, can you change that to .net 6 and check if that works.
reference link

#320866
Apr 22, 2024 15:18

Optimizely has been supporting .NET 8 since it came out in November 2023. See https://world.optimizely.com/blogs/Magnus-Rahl/Dates/2023/11/support-for--net-8/

This issue is not related to the framework. It's got to do with websockets that is used for parts of the new UI. When switching between CMS/Commerce UI and any third-part UI/plugin, this error is thrown. On our end we can reproduce it locally as well. As already mentioned, it seems to be fixed in 12.29.0, but I haven't had a chance to test it yet myself.

#320915
Edited, Apr 23, 2024 7:18
Johan Book - Jan 02, 2025 17:23
I can verify that this error is finally gone after having upgraded to 12.29.0! 👍
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.