-
Notifications
You must be signed in to change notification settings - Fork 58
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
NullPointerException, ConflictResolverInterface, Mutation fails #98
Comments
Thank you for reporting this issue. I will look into this and post an update here once I have more information. |
Version 2.7.5 of the SDK has a fix for this issue. For the Conflict Resolution feature, you have to pass in a custom config resolver. See the following two links for an example of how to do that Line 98 in 757d8e0
Line 262 in 757d8e0
Please give it a try and let us know how it goes. |
@cbommas Thank you. There is no NPE anymore. But now I get onFailure() after successful mutation (using default ConflictResolver) timestamp: 2019-01-15 17:35:35.575 |
I took a look at the attached log and this is the expected behavior. It looks like you are not passing in your conflict resolver when you create the AppSync Client. When a conflict resolver is not passed in and a conflict is detected, the default behavior is to fail the mutation and invoke the onError callback method. See below for how you would pass in your conflict resolver
I am confused by your comment about using the default Conflict Resolver. Can you elaborate? |
@cbommas I've researched this issue again: this error is on our side. Thank you very much for your help!) |
@cbommas What this logs mean and can I suppose it somehow if it's not important 2019-01-16 16:11:48.565 16346-16550/com.moja V/AppSyncOfflineMutationManager: Thread:[15367]:Persistent mutations queue is EMPTY!. Will check inMemory Queue next |
@DeMoss15 |
hi , i want to format datetime to date in resolver of appsync for my requirement .. |
caching strategy NETWORK_ONLY
NPE was on previous versions of the sdk too. But there was no queue.
In latest version requests are being just added to this queue and waited for smth.
In previous versions, even after exception, all mutations were being executed.
here is stack trace of NPE:
V/InterceptorCallback: Thread:[13268]: onResponse()
D/InterceptorCallback: Thread:[13268]: onResponse -- found error
D/InterceptorCallback: Thread:[13268]: onResponse -- Got a string match in the errors for "The conditional request failed".
Thread:[13268]: Conflict String: {"__typename":"UserPost","userId":"3ef6eeb7-d1d3-4060-8d2b-1c929ecef914","createdAt":"2019-01-09T13:44:55.388Z","content":"Hello World","authorType":"USER","author":null,"authorStorefront":null}
Thread:[13268]: Client String: {"createdAt":"2019-01-09T13:44:55.388Z"}
D/InterceptorCallback: Thread:[13268]: onCompleted()
2019-01-09 15:33:36.872 12487-12891/com.moja V/QueueUpdateHandler: Thread:[13124]: Got message to take action on the mutation queue.
2019-01-09 15:33:36.872 12487-12891/com.moja D/QueueUpdateHandler: Thread:[13124]: Got message that a originalMutation process needs to be retried.
2019-01-09 15:33:36.873 12487-12891/com.moja V/QueueUpdateHandler: Thread:[13124]: java.lang.NullPointerException: Attempt to invoke interface method 'void com.amazonaws.mobileconnectors.appsync.ConflictResolverInterface.resolveConflict(com.amazonaws.mobileconnectors.appsync.ConflictResolutionHandler, org.json.JSONObject, org.json.JSONObject, java.lang.String, java.lang.String)' on a null object reference
2019-01-09 15:33:36.873 12487-12891/com.moja W/System.err: java.lang.NullPointerException: Attempt to invoke interface method 'void com.amazonaws.mobileconnectors.appsync.ConflictResolverInterface.resolveConflict(com.amazonaws.mobileconnectors.appsync.ConflictResolutionHandler, org.json.JSONObject, org.json.JSONObject, java.lang.String, java.lang.String)' on a null object reference
2019-01-09 15:33:36.874 12487-12891/com.moja W/System.err: at com.amazonaws.mobileconnectors.appsync.AppSyncOfflineMutationInterceptor$QueueUpdateHandler.handleMessage(AppSyncOfflineMutationInterceptor.java:273 )
2019-01-09 15:33:36.874 12487-12891/com.moja W/System.err: at android.os.Handler.dispatchMessage(Handler.java:107 )
2019-01-09 15:33:36.874 12487-12891/com.moja W/System.err: at android.os.Looper.loop(Looper.java:198 )
2019-01-09 15:33:36.874 12487-12891/com.moja W/System.err: at android.os.HandlerThread.run (HandlerThread.java:65 )
whole stack traces:
before:
appsync_version_2,7,4.txt
after:
appsync_version_2,6,28.txt
The text was updated successfully, but these errors were encountered: