diff --git a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/FaceLivenessSession.swift b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/FaceLivenessSession.swift index 63b594c2e8..28bc6e8917 100644 --- a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/FaceLivenessSession.swift +++ b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/FaceLivenessSession.swift @@ -210,6 +210,10 @@ public final class FaceLivenessSession: LivenessService { connectingState == .normal, let savedURLForReconnect, let serverDate else { + if let runtimeError = URLSessionWebSocketTask.CloseCode(rawValue: 4_005) { + Amplify.log.verbose("\(#function): Closing websocket with runtime error") + closeSocket(with: runtimeError) + } onServiceException(.init(event: exceptionEvent)) return .stopAndInvalidateSession }