5

Im 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]'."

1 Answers1

4

The returnValues is not a valid field for the request mapping template of AppSync with DynamoDB. By default AppSync uses the ALL_NEW parameter for updates.

Vasileios Lekakis
  • 5,492
  • 2
  • 15
  • 17