Skip to content
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

When a conflict occurs and ConflictResolver is invoked, GraphQL.Callback is not called back #50

Closed
mmarceau opened this issue Oct 16, 2018 · 4 comments
Assignees
Labels
bug Something isn't working pending-response Issue is pending response from the issue requestor

Comments

@mmarceau
Copy link

Describe the bug
As a dev, I should be able to fail in a conflict resolver and have that failure come back as an onFailure callback in GraphQL.Callback with a special code telling me the failure was do to a conflict.

To Reproduce
Steps to reproduce the behavior:

  1. Create a mutation in AppSync that will conditionally update based on expectedVersion. (i.e. there is a template for this)
  2. Execute the mutation on Android client using enqueue with GraphQL.Callback using an object in with an older version number.
  3. A conflict occurs on the AppSync backend as expected and and my custom ConflictResolver is invoked on the client.
  4. I fail the conflict.
  5. GraphQL.Callback is never called back. I have no way of telling my UI to stop waiting.

Expected behavior
GraphQL.Callback should be called back in a ConflictResolver failure scenario.

Environment(please complete the following information):

  • AppSync SDK Version: 2.6.26

Device Information (please complete the following information):

  • Device: Pixel XL API 28 Simulator
@frankmuellr frankmuellr added the bug Something isn't working label Nov 15, 2018
@scb01
Copy link
Contributor

scb01 commented Dec 8, 2018

@mmarceau
Just wanted to let you know that I am looking at this issue and will post an update here once I have more information.

@scb01
Copy link
Contributor

scb01 commented Jan 15, 2019

@mmarceau
Version 2.7.5 of the SDK contains changes to address this issue. The callback will be called if you fail a mutation in the conflict resolver code.

In the onFailure, you can check if the exception is an instance of ConflictResolutionFailedException to know that the failure was due to a conflict. See the following test for an example

Please give this a try and let us know how it goes.

@scb01 scb01 added pending-response Issue is pending response from the issue requestor closing-soon labels Jan 15, 2019
@mmarceau
Copy link
Author

Thank you @cbommas - This is now working 👍

@stale stale bot removed the closing-soon label Jan 24, 2019
@scb01
Copy link
Contributor

scb01 commented Jan 24, 2019

@mmarceau
Good to hear. I will go ahead and close out this issue. Please feel free to post back here ( or create a new issue) if you run into problems.

@scb01 scb01 closed this as completed Jan 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending-response Issue is pending response from the issue requestor
Projects
None yet
Development

No branches or pull requests

3 participants