Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown errors #3546

Closed
alekkova opened this issue Feb 29, 2024 · 7 comments
Closed

Unknown errors #3546

alekkova opened this issue Feb 29, 2024 · 7 comments
Labels
predictions Issues related to the Predictions category question General question

Comments

@alekkova
Copy link

Is your feature request related to a problem? Please describe.

LivenessEventKind.Exception has some predefined exceptions:

public struct Exception: RawRepresentable, Equatable {
public var rawValue: String
public init(rawValue: String) {
self.rawValue = rawValue
}
public static let accessDenied = Self(rawValue: "AccessDeniedException")
public static let validation = Self(rawValue: "ValidationException")
public static let internalServer = Self(rawValue: "InternalServerException")
public static let throttling = Self(rawValue: "ThrottlingException")
public static let serviceQuotaExceeded = Self(rawValue: "ServiceQuotaExceededException")
public static let serviceUnavailable = Self(rawValue: "ServiceUnavailableException")
public static let sessionNotFound = Self(rawValue: "SessionNotFoundException")
}

Predefined exceptions are translated to a corresponding FaceLivenessSessionError. But all other exceptions are translated to FaceLivenessSessionError.unknown.

extension FaceLivenessSessionError {
init(event: LivenessEventKind.Exception) {
switch event {
case .accessDenied:
self = .accessDenied
case .validation:
self = .validation
case .internalServer:
self = .internalServer
case .throttling:
self = .throttling
case .serviceQuotaExceeded:
self = .serviceQuotaExceeded
case .serviceUnavailable:
self = .serviceUnavailable
case .sessionNotFound:
self = .sessionNotFound
default:
self = .unknown
}
}
}

When other exceptions happen it is impossible to understand the reason for an error.

User was receiving a FaceLiveness.FaceLivenessDetectionError(code: 0, message: "An unknown error occurred.", recoverySuggestion: "Please open an issue....") and it took way too much effort to prepare and distribute a special build for the user using a modified Amplify package where a InvalidSignatureException exception header value could finally be observed which hinted about the underlying issue.

} else if let exceptionType = message.headers.first(where: { $0.name == ":exception-type" }) {
let exceptionEvent = LivenessEventKind.Exception(rawValue: exceptionType.value)
onServiceException(.init(event: exceptionEvent))

Describe the solution you'd like

Provide better error descriptions and avoid using unknown errors. Providing at least exception header value would already help in understanding the underlying error.

Describe alternatives you've considered

There are no alternatives.

Is the feature request related to any of the existing Amplify categories?

Predictions

Additional context

No response

@phantumcode phantumcode added predictions Issues related to the Predictions category question General question labels Feb 29, 2024
@phantumcode
Copy link
Member

@alekkova Thanks for submitting the issue. We'll investigate and provide updates here.

@phantumcode
Copy link
Member

@alekkova The code currently supports all possible exception from LivenessEventKind.Exception. The default unknown is to provide a graceful fallback if or when a new exception type is added from the Rekognition. Are you observing or seeing an exception that is properly handled?

@phantumcode phantumcode added the pending-community-response Issue is pending response from the issue requestor label Feb 29, 2024
@alekkova
Copy link
Author

@phantumcode thank you for looking into it.

We have stumbled on a case where LivenessEventKind.Exception is initialised with a rawValue: "InvalidSignatureException" . This happens here:

} else if let exceptionType = message.headers.first(where: { $0.name == ":exception-type" }) {
let exceptionEvent = LivenessEventKind.Exception(rawValue: exceptionType.value)
onServiceException(.init(event: exceptionEvent))

This leads to a very unclear "unknown error" on client side, which gives no information about the issue at all. I am worried if there are also other exception types that lead to an unknown error on client side.

@github-actions github-actions bot removed the pending-community-response Issue is pending response from the issue requestor label Feb 29, 2024
@phantumcode
Copy link
Member

@alekkova This is a bug with the service not properly catching the InvalidSignatureException and returning an AccessDeniedException. A ticket has been created and assigned to the Rekognition service team to fix this issue.

@alekkova
Copy link
Author

alekkova commented Mar 4, 2024

Thanks @phantumcode. It would also be appreciated if we received more descriptive errors on client side. For example InvalidSignatureException is more descriptive than AccessDeniedException.

@phantumcode
Copy link
Member

@alekkova Thanks you for your feedback. Can you submit a feature request to improve the Liveness client side error messages in the Liveness repo https://github.com/aws-amplify/amplify-ui-swift-liveness

Copy link
Contributor

github-actions bot commented Mar 5, 2024

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
predictions Issues related to the Predictions category question General question
Projects
None yet
Development

No branches or pull requests

2 participants