Comments (11)
running the sample (no edits. just follow the instruction)
https://github.com/aws-samples/aws-mobile-appsync-events-starter-android
produces the same error.
steps:
turn off internet
create event
after creating event, turn internet on
from aws-mobile-appsync-sdk-android.
Does this only happen on first offline mutation or all offline mutations? Do the normal mutations go through fine?
from aws-mobile-appsync-sdk-android.
This happens to all of the offline mutation. Sometimes the first offline mutation go in.
Normal mutations are fine.
Take note. the aws appsync android sample also does not work. Same error.
I have a solution that is currently working but after about a hundred of call it fails.
too many open files error. or sometimes a syqlite error
i removed the client checking so now my app always creates a new appsync client.
doing this made it work not sure why. but eventually ffails so i need a real solution here.
//if(client == null){
client = AWSAppSyncClient.builder()
.context(context)
.cognitoUserPoolsAuthProvider(getUserPoolAuthProvider(context))
.region(Constants.APPSYNC_REGION)
.serverUrl(Constants.APPSYNC_API_URL)
.persistentMutationsCallback(persistentMutationCallback)
.build();
//}
``
from aws-mobile-appsync-sdk-android.
I tested a bit more.
Doing offline mutation closing the app and opening it up again then turning the internet makes it work.
So basically i think the persistent cache is working. The in memory is the one that fails.
I think that is also the reason why my temp solution works because it forces appsync to store the mutation in the persistent cache.
from aws-mobile-appsync-sdk-android.
Thanks for the details @danielvtan I will investigate the issue.
from aws-mobile-appsync-sdk-android.
I got a temporary fix working. I edited the appsync sdk a bit. Here is what i did.
I removed the in memory mutation by removing this line
//AppSyncOfflineMutationManager.java -> addMutationObjectInQueue
inMemoryOfflineMutationManager.addMutationObjectInQueue(mutationObject);
to replace the in memory mutation i always call this after a mutation.
//PersistentOfflineMutationManager
persistentOfflineMutationObjects = fetchPersistentMutationsList();
persistentOfflineMutationObjectMap = new HashMap<>();
for (PersistentOfflineMutationObject object: persistentOfflineMutationObjects) {
persistentOfflineMutationObjectMap.put(object.recordIdentifier, object);
}
Log.d("AppSync", "There these many records in persistent cache: " + persistentOfflineMutationObjects.size());
the purpose of the code above is to ditch the in memory mutation entirely
after that here is the actual temp solution
in AppSyncCustomNetworkInvoker.java -> executeRequest
i call this in the run function
OkHttpClient okHttpClient = (OkHttpClient) httpCallFactory;
okHttpClient.connectionPool().evictAll();
after doing this, offline and online mutation are finally working.
for the full explanation i am not really sure but i got the idea from this issue square/okhttp#3146 which is still open and not resolved
Please make an actual fix for this. thank you!
from aws-mobile-appsync-sdk-android.
I see the same exception... The mutation is longer available and our client and backend are out of sync.
D/AppSync: onFailure()Failed to execute http call
D/AppSync: Got message to take action regarding mutation queue.
D/AppSync: Got message that a originalMutation process errored out.
D/AppSync: Checking if I need to process next originalMutation
D/AppSync: First check: Internet Available
D/AppSync: Second check: Persistent mutations queue is EMPTY!
D/AppSync: Third check: Inmemory mutations queue is EMPTY!
2018-11-14 19:24:13.381 10200-10261/com.regiscorp.athena.pos E/TransactionSDKImpl: Failed to execute mutation com.apollographql.apollo.exception.ApolloNetworkException: Failed to execute http call at com.apollographql.apollo.internal.interceptor.ApolloServerInterceptor$1$1.onFailure(ApolloServerInterceptor.java:105) at okhttp3.RealCall$AsyncCall.execute(RealCall.java:148) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761) Caused by: java.net.SocketTimeoutException: timeout at okhttp3.internal.http2.Http2Stream$StreamTimeout.newTimeoutException(Http2Stream.java:593) at okhttp3.internal.http2.Http2Stream$StreamTimeout.exitAndThrowIfTimedOut(Http2Stream.java:601) at okhttp3.internal.http2.Http2Stream.takeResponseHeaders(Http2Stream.java:146) at okhttp3.internal.http2.Http2Codec.readResponseHeaders(Http2Codec.java:120) at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:75) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at com.amazonaws.mobileconnectors.appsync.sigv4.AppSyncSigV4SignerInterceptor.intercept(AppSyncSigV4SignerInterceptor.java:182) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at com.amazonaws.mobileconnectors.appsync.retry.RetryInterceptor.intercept(RetryInterceptor.java:48) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185) at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761)
from aws-mobile-appsync-sdk-android.
I am investigating this issue currently. My working theory at this point is that the mutation is being removed from the queue before it is successfully processed as reported in #40 and is lost if the operation fails due to a network error.
I am testing a couple of fixes locally that I hope to include in an upcoming release of the SDK. I will post back on this thread once I have more updates.
from aws-mobile-appsync-sdk-android.
Version 2.7.1 of the SDK contains the queuing fixes logic to address the issue that you reported. Please upgrade to this version and let us know how you fare.
from aws-mobile-appsync-sdk-android.
@danielvtan @donaldarmstrong
Looks like you are good to go. I'll close out this thread - please feel free to post back here or create a new thread if you are still running into issues.
from aws-mobile-appsync-sdk-android.
@cbommas thanks for the fixes. Currently i can not test this as we are using a modified version of the sdk. We will test this for our next project.
from aws-mobile-appsync-sdk-android.
Related Issues (20)
- Execution failed for task ':app:nodeSetup'. HOT 1
- android.net.ConnectivityManager$TooManyRequestsException HOT 9
- Execution failed for task ':app:nodeSetup'. HOT 5
- Android Studio Bumblebee will further break compatibility with Jetpack libraries HOT 3
- NullPointerException: Attempt to invoke virtual method 'org.json.JSONObject com.amazonaws.mobile.config.AWSConfiguration.optJsonObject(java.lang.String)' on a null object reference HOT 3
- No ability to serlialize null input fields
- App Sync SDK crashing with SQLiteBlobTooBigException HOT 4
- How can we encrypt cache data
- AppSync codegen models throws @Nullable @Nullable HOT 4
- AppSync codegen model "S3ObjectInput" methods override error
- Cognito API InitiateAuth + REFRESH_TOKEN_AUTH does not return updated RefreshToken HOT 2
- Fatal Exception: java.lang.NullPointerException: Parameter specified as non-null is null
- AppSync gradle plugin has conflict with Apollo3 plugin HOT 1
- GraphQL subscription error 403 HOT 1
- Wrong serialisation for Enum type in WebSocketConnectionManager
- AWSAppSyncClient is not generating code from the graphql file in Android HOT 20
- AWS appsync doesn't build with agp version 8.0 HOT 5
- app crashes when retrying all subscriptions HOT 1
- Gradle configuration cache support HOT 2
- Fix critical vulnerability CVE-2022-4725 flagged by Sonarqube on dependency: aws-android-sdk-mobile-client 2.22.1 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-mobile-appsync-sdk-android.