从Step Function查询DynamoDB时,“Query condition missed key schema element”

0

【以下的问题经过翻译处理】 我正在尝试在Step Function中查询DynamoDB表,但出现以下错误。

Query condition missed key schema element: Scope (Service: DynamoDb, Status Code: 400, Request ID: FN4G...)

步骤函数任务定义是;

"Obtain user list": {
      "Type": "Task",
      "Parameters": {
        "TableName": "Users",
        "KeyConditionExpression": "#Scope = :Global",
        "ExpressionAttributeNames": {
          "#Scope": {
            "S": "Scope"
          }
        },
        "ExpressionAttributeValues": {
          ":Global": {
            "S": "Global"
          }
        }
      },
      "Resource": "arn:aws:states:::aws-sdk:dynamodb:query",
      "Next": "Pass"
    },

DynamoDB定义是; ![表设置](/media/postImages/original/IM1D-csEKnQZSOo4v3JU5BKw)

这是来自表中的示例项目;

{
  “Scope”:{
    “S”:“Global”
  },
  “ServiceName”:{
    “S”:“driver”
  },
  “lastVisitDateTime”:{
    “N”:“1680022106”
  },
  “Status”:{
    “S”:“ONLINE”
  }
},

有什么指示我缺失了什么吗?谢谢!

profile picture
專家
已提問 8 個月前檢視次數 69 次
1 個回答
0

【以下的回答经过翻译处理】 我使用KeyConditions得以使其工作。

{
  "Type": "Task",
  "Parameters": {
    "TableName": "Users,
    "KeyConditions": {
      "Scope": {
        "ComparisonOperator": "EQ",
        "AttributeValueList": [
          {
            "S": "Global"
          }
        ]
      }
    }
  },
  "Resource": "arn:aws:states:::aws-sdk:dynamodb:query",
  "Next": "Pass"
}
profile picture
專家
已回答 8 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南