Amplify-android: IOException: Canceled fom OkHttp

Created on 16 Sep 2020  路  4Comments  路  Source: aws-amplify/amplify-android

I found an issue with Datastore version 1.3.2

I am using Cognito email-based authentication version 1.3.2 and Amplify API version 1.3.2

Not sure where this is happening exactly, but please let me know whether you need more specific information to track the issue.

E/AndroidRuntime: FATAL EXCEPTION: OkHttp https://tsyg452ldjelxousvmrndqqqzu.appsync-api.us-east-1.amazonaws.com/...
    Process: com.invernaderolabs.checkin, PID: 19218
    io.reactivex.rxjava3.exceptions.UndeliverableException: The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the exception has nowhere to go to begin with. Further reading: https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling | AmplifyException {message=Failure performing sync query to AppSync., cause=AmplifyException {message=Could not retrieve the response body from the returned JSON, cause=java.io.IOException: Canceled, recoverySuggestion=Sorry, we don't have a suggested fix for this error yet.}, recoverySuggestion=Sorry, we don't have a suggested fix for this error yet.}
        at io.reactivex.rxjava3.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:367)
        at io.reactivex.rxjava3.internal.operators.single.SingleCreate$Emitter.onError(SingleCreate.java:82)
        at com.amplifyframework.datastore.syncengine.-$$Lambda$PymunRoF4O3jbMDeD82w6kHUXIM.accept(Unknown Source:4)
        at com.amplifyframework.datastore.appsync.AppSyncClient.lambda$sync$1(AppSyncClient.java:98)
        at com.amplifyframework.datastore.appsync.-$$Lambda$AppSyncClient$suvEma05s-p8v-66iE4cswLKYac.accept(Unknown Source:4)
        at com.amplifyframework.api.aws.AppSyncGraphQLOperation$OkHttpCallback.onFailure(AppSyncGraphQLOperation.java:150)
        at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:525)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)
     Caused by: AmplifyException {message=Failure performing sync query to AppSync., cause=AmplifyException {message=Could not retrieve the response body from the returned JSON, cause=java.io.IOException: Canceled, recoverySuggestion=Sorry, we don't have a suggested fix for this error yet.}, recoverySuggestion=Sorry, we don't have a suggested fix for this error yet.}
        at com.amplifyframework.datastore.appsync.AppSyncClient.lambda$sync$1(AppSyncClient.java:98) 
        at com.amplifyframework.datastore.appsync.-$$Lambda$AppSyncClient$suvEma05s-p8v-66iE4cswLKYac.accept(Unknown Source:4) 
        at com.amplifyframework.api.aws.AppSyncGraphQLOperation$OkHttpCallback.onFailure(AppSyncGraphQLOperation.java:150) 
        at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:525) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:923) 
     Caused by: AmplifyException {message=Could not retrieve the response body from the returned JSON, cause=java.io.IOException: Canceled, recoverySuggestion=Sorry, we don't have a suggested fix for this error yet.}
        at com.amplifyframework.api.aws.AppSyncGraphQLOperation$OkHttpCallback.onFailure(AppSyncGraphQLOperation.java:150) 
        at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:525) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:923) 
     Caused by: java.io.IOException: Canceled
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:72)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at com.amplifyframework.api.aws.sigv4.AppSyncSigV4SignerInterceptor.intercept(AppSyncSigV4SignerInterceptor.java:236)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
        at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:923) 
Bug Clarification Needed Closing Soon DataStore

Most helpful comment

Hey! It seems like this issue went away with version 1.4.0.

All 4 comments

@jamesonwilliams it seems it need Clarification, there is something we can do?, @upachecog

Are you able to consistently reproduce it? If so, let us know what the steps are.

If it's something that happens sporadically, let us know any additional details such as:

  • Does it happen when logging in?
  • Does it happen when the app has been running a while?

Anything additional that you can provide such as schemas and code snippets are also helpful.

@cmllamosas @upachecog Can you please include more context on this, so that we can better help?

  1. Code you use to initialize Amplify, and call DataStore?
  2. Your ampilfyconfiguration.json (with IDs and credentials scrubbed out)
  3. Logs with context leading up to the crash
  4. You GraphQL schema.

For (3), you can get _verbose_ logs by setting up Amplify this way:

// Note the explicit addition of a logging plugin with verbose log level
Amplify.addPlugin(AndroidLoggingPlugin(LogLevel.VERBOSE))
Amplify.addPlugin(AWSApiPlugin())
Amplify.addPlugin(AWSDataStorePlugin())
Amplify.configure(applicationContext)

Hey! It seems like this issue went away with version 1.4.0.

Was this page helpful?
0 / 5 - 0 ratings