Invalid update expression: two document paths overlap with each other Appsync

Viewed 158

I am trying to create a map(userStatus in my case) incase it doesn't exist and also update it's key value in one pass.

here is the code from my appsync request template

{
    "version": "2018-05-29",
    "operation": "UpdateItem",
      "key": {
          "topicId": $util.dynamodb.toDynamoDBJson($ctx.stash.topicId)
      },
      "update" : {
          "expression" : "SET userStatus = if_not_exists(userStatus, :emptymap), userStatus.#idx = :userContent",
          "expressionNames": {
              "#idx": "$ctx.args.input.event.payload.userId"
          },
          "expressionValues": {
              ":emptymap" : $util.dynamodb.toDynamoDBJson({}),
              ":userContent" : $util.dynamodb.toDynamoDBJson($userStatusContent)
          }
      }
}

i'm getting this error "Two document paths overlap with each other; must remove or rewrite one of these paths", How can i solve this?

0 Answers
Related