Open Lorenzohidalgo opened 7 months ago
Docs state that one should be able to see that data by default on ctx.error.data, but this doesn't seem to be the case.
ctx.error.data
{ "arguments": { "recordInput": { "id": "1", "sk": "1" } }, "prev": { "result": {} }, "stash": {}, "error": { "message": "The conditional request failed (Service: DynamoDb, Status Code: 400, Request ID: 3S...)", "type": "DynamoDB:ConditionalCheckFailedException" }, "outErrors": [] }
There is also no returnValuesOnConditionCheckFailure attribute for the UpdateItem operation allowed.
returnValuesOnConditionCheckFailure
UpdateItem
Actual response (where docs state we should also be able to see the old/current record values):
{ "data": { "extendTtl": null }, "errors": [ { "path": [ "extendTtl" ], "data": null, "errorType": null, "errorInfo": null, "locations": [ { "line": 2, "column": 3, "sourceName": null } ], "message": "The conditional request failed (Service: DynamoDb, Status Code: 400, Request ID: 3S...)" } ] }
With TransactWriteItems, where for some reason you can actually use returnValuesOnConditionCheckFailure for an UpdateItem operation, it seems to work as expected and the value is reachable in the ctx:
TransactWriteItems
{ "arguments": { "recordInput": { "id": "1", "sk": "1" } }, "result": { "cancellationReasons": [ { "type": "ConditionalCheckFailed", "message": "The conditional request failed", "item": { "test": { "test1": true }, "sk": "1", "testField": "1-1", "id": "1", "ttl": 1705338604 } } ] }, "prev": { "result": {} }, "stash": {}, "error": { "message": "Transaction cancelled, please refer cancellation reasons for specific reasons [ConditionalCheckFailed] (Service: DynamoDb, Status Code: 400, Request ID: OTL...)", "type": "DynamoDB:TransactionCanceledException" }, "outErrors": [] }
But using TransactWriteItems isn't really an option, as it doesn't return all values of the updated record...
According to AWS support the docs are outdated and this field will not be present with APPSYNC_JS. I'm hoping for an official update here as well.
Docs state that one should be able to see that data by default on
ctx.error.data
, but this doesn't seem to be the case.There is also no
returnValuesOnConditionCheckFailure
attribute for theUpdateItem
operation allowed.Actual response (where docs state we should also be able to see the old/current record values):
With
TransactWriteItems
, where for some reason you can actually usereturnValuesOnConditionCheckFailure
for anUpdateItem
operation, it seems to work as expected and the value is reachable in the ctx:But using
TransactWriteItems
isn't really an option, as it doesn't return all values of the updated record...