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

service/dynamodb: No way to get CancellationReasons from a TransactionCanceledException? #2318

Closed
guregu opened this issue Nov 29, 2018 · 6 comments
Labels
feature-request A feature should be added or improved.

Comments

@guregu
Copy link

guregu commented Nov 29, 2018

Version of AWS SDK for Go?

v1.15.86

Version of Go (go version)?

go version go1.10.3 darwin/amd64

What issue did you see?

When I try to execute a TransactWriteItems with conditions in the items that fail, there seems to be no way to get the CancellationReasons from the error that is returned. This also means that I can't retrieve the original data of the failing items when I set ReturnValuesOnConditionCheckFailure to be ReturnValuesOnConditionCheckFailureAllOld.

Steps to reproduce

  1. Create a TransactWriteItems request with a few puts.
  2. Include a failing condition in one of the puts.
  3. Something like this error is returned (this is output from go-spew):
(*awserr.requestError)(0xc42014a1e0)({
 awsError: (*awserr.baseError)(0xc4202f61c0)({
  code: (string) (len=28) "TransactionCanceledException",
  message: (string) (len=108) "Transaction cancelled, please refer cancellation reasons for specific reasons [ConditionalCheckFailed, None]",
  errs: ([]error) <nil>
 }),
 statusCode: (int) 400,
 requestID: (string) (len=52) "[omitted]"
})

As far as I can tell, there's no way to get the CancellationReasons from this (which are present in the response JSON when I enable verbose logging). Apologies if I'm simply overlooking the correct method.

@diehlaws diehlaws self-assigned this Nov 29, 2018
@diehlaws diehlaws added the feature-request A feature should be added or improved. label Nov 29, 2018
@diehlaws
Copy link
Contributor

Thank you for reaching out about this @guregu. While the CancellationReason structure is present in the API model for DynamoDB, the AWS SDK for Java is the only SDK that currently supports unmarshalling this structure. I've marked this issue as a Feature Request, and will bring it up in our next sprint.

@guregu guregu mentioned this issue Dec 26, 2018
6 tasks
@ronnylt
Copy link

ronnylt commented May 21, 2019

Any update on this? Thanks!

@jasdel
Copy link
Contributor

jasdel commented Jun 3, 2019

Hi @ronnylt, the support for unmarshaling API errors is still an outstanding item on our backlog. In the meantime we do have a workaround example, https://github.com/aws/aws-sdk-go/blob/master/example/service/dynamodb/transactWriteItems that will show how you can workaround this issue.

@ccbrown
Copy link

ccbrown commented Jul 19, 2019

@jasdel Is there some sort of blocker for this or is it just a matter of someone putting in the effort? If it's the latter, I'll be glad to put in a PR. But considering you went through the effort of putting together that example rather than a PR, I'm guessing there's some other issue?

@nc-wittj
Copy link

Has this been fixed in v1.28.0? I haven't gotten the chance to check, but it seems to be the case looking at the SDK Features release notes.

@skotambkar
Copy link
Contributor

This has been fixed in v1.28.0 . I will go ahead and close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

7 participants