"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
posta un anno fa655 visualizzazioni
1 Risposta
0
Risposta accettata

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
con risposta un anno fa
profile picture
ESPERTO
verificato un anno fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande