"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
질문됨 일 년 전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
답변함 일 년 전
profile picture
전문가
검토됨 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠