aws / aws/aws-appsync-community

Support for DynamoDB ReturnValues

Open
#341 6 comments 4 reactions 0 assignees View on GitHub
feature-request
Dominant language
HTML
Stars
507
Forks
37
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Research direction

Start with the UpdateItem resolver example in the issue and compare AppSync's supported request mapping syntax with DynamoDB's ReturnValues options. Done means the supported way to request the previous updated attribute value is identified and documented, or the unsupported behavior is clearly confirmed.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, graphql
Domain
api, database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.