Closed jellybeansoup closed 9 months ago
Thank you for opening this issue. AWS AppSync SDK for iOS entered maintenance mode in September 2023 and will receive no further updates as of September 2024.
Please use Amplify Swift going forward. For information on upgrading to Amplify Swift, refer to the Upgrade from AppSync SDK documentation.
Is your feature request related to a problem? Please describe. Within the codebase at SEEK, we utilise Alamofire for our networking layer. As part of this solution, we also implement a custom instance of the
AWSNetworkTransport
protocol to pass mutation requests through this networking layer.We recently discovered, however, that due to the way AWSAppSync determines whether a mutation should be retried—by checking the domain of the error and then using some of the cases to determine what the error is—our mutations were failing an not being retried, because Alamofire produces a custom error type, i.e.
AFError
.Describe the solution you'd like A method whereby the calling app is asked what errors should constitute retrying the network call. This could be done using an
AWSRetryableMutationError
protocol with a simple boolean property that indicates if the request should be retried.This could then replace the existing
AWSMutationRetryAdviceHelper
class with something extensible, with internal conformances forAWSAppSyncClientError
andNSError
to provide the existing behaviour.Describe alternatives you've considered The potentially-obvious (but crude) resolution would be to check for the appropriate
AFError
cases withinAWSMutationRetryAdviceHelper
, but this involves adding explicit support for a third-party library, and may have other ramifications throughout the AWSAppSync codebase.The other resolution would be to unwrap the
AFError
cases inside the customAWSNetworkTransport
, extracting the system-level errors that they contain. This is an entirely workable solution—and we plan to do something like this regardless—but it doesn't allow for the possibility of reattempting for reasons other than the pre-prescribed options available.Additional context I'm more than happy to put together a PR for this if desired, but since it involves a (very minor) architecture change, I didn't want to make any assumptions with regard to why the existing implementation is unable to be extended.