"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
gefragt vor einem Jahr658 Aufrufe
1 Antwort
0
Akzeptierte Antwort

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
beantwortet vor einem Jahr
profile picture
EXPERTE
überprüft vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen