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

Handle the AWSAppSyncClient timeout #91

Closed
anupsarode opened this Issue Oct 30, 2018 · 6 comments

Comments

Projects
None yet
5 participants
@anupsarode
Copy link

anupsarode commented Oct 30, 2018

I am trying my hands on with AppSync iOS and want to get a failure callback for a fetch query when the internet is not available.

When the internet is available, the following code outputs both "sending" and "receiving". But when the internet is not available, I do not get any callback from AppSync client. The code only outputs "sending".

`print("sending")
self.appSyncClient?.fetch(query: getCategoriesQuery, cachePolicy: .fetchIgnoringCacheData) { (result, error) in

    print("receiving")
    if let error = error as? AWSAppSyncClientError {
        print("Error getting Categories from AppSync API: \(error.localizedDescription )")
    }
    else {
        print("Result - ", result?.data?.getCategories?.items!)
    }
}`

After the network timeout, the xCode console outputs

"HTTP load failed (error code: -1001 [1:60])"

"finished with error - code: -1001"

How can I handle the network failure here? Any help is appreciated.

@dreamBegin

This comment has been minimized.

Copy link

dreamBegin commented Oct 31, 2018

This is a serious issue and a basic one too.You can put a internet check before firing query but what you can do when there is slow internet connection? We really need something working as soon as possible.

@rohandubal

This comment has been minimized.

Copy link
Contributor

rohandubal commented Nov 20, 2018

Hello @anupsarode @dreamBegin

This is fixed in SDK version 2.7.0

Please try it out and let us know if you continue facing issues.

Thanks,
Rohan

@dreamBegin

This comment has been minimized.

Copy link

dreamBegin commented Nov 21, 2018

Hey @rohandubal

Thank you so much for being active and getting back to us let me update my code from swift 4.0 to 4.2 then i'll update to version 2.7.0.
Thanks

@anupsarode

This comment has been minimized.

Copy link

anupsarode commented Nov 21, 2018

Hello @rohandubal

Thanks for updating the SDK. I just tested out and seems like it has been fixed.

When I am firing any AppSync query with no internet available, I am getting the localized error description as "Did not receive a successful HTTP code. Error: Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline."

Best,
Anup

@dreamBegin

This comment has been minimized.

Copy link

dreamBegin commented Nov 21, 2018

Hey @rohandubal , Glad to inform problem solved. I have tested too.

@muellerfr

This comment has been minimized.

Copy link
Contributor

muellerfr commented Nov 21, 2018

@dreamBegin, excellent - thank you for the quick verification.

@muellerfr muellerfr closed this Nov 21, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment