"Query condition missed key schema element" when querying DynamoDB from Step Function

0

I'm trying to query a DynamoDB table in a Step Function but it's throwing the following error.

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

The Step Function Task definition is;

    "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"
    },

The DynamoDB definition is; Tabel settings

And here's a sample item from the table

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

Any pointers on what I'm missing?? Thanks!

DB
已提問 1 年前檢視次數 658 次
1 個回答
0
已接受的答案

Ah! I was able to get it working using KeyConditions

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

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

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

回答問題指南