aws / aws-appsync-community

The AWS AppSync community
https://aws.amazon.com/appsync
Apache License 2.0
506 stars 32 forks source link

Support for DynamoDB ReturnValues #341

Open h2whoa3 opened 8 months ago

h2whoa3 commented 8 months ago

I'm trying to update an item attribute in a DynamoDb table with AppSync. Once successful i want to use the previous value of that attribute as the key in my next call (I'm using pipeline resolvers).

To achieve this with DynamoDB you just set UPDATED_OLD as the return value.

I cannot find any documentation for specifying the return value of a DynamoDB resolver for AppSync. Ive tried the following.

{
  "version" : "2018-05-29",
  "operation" : "UpdateItem",
  "key": {
        "id": $util.dynamodb.toDynamoDBJson("foo")
      },
   "condition" : {
   "expression" : "attribute_exists(id)"
    },
    "update" : {
    "expression" : "SET bar = :bar",
    "expressionValues" : {
        ":bar" :  {"S" : "$bar"}
      }
    },
    "returnValues": "UPDATED_OLD"
  }

But its not valid syntax.

"message": "Unsupported element '$[returnValues]'."

onlybakam commented 7 months ago

This is currently not supported in AppSync. I've marked the issue as a feature request.

perryn commented 5 months ago

I need this feature too.