Are there any cases lead to "Query condition missed key schema element : sort key" ?

0

I met a really weird question when I was using DynamoDB in the project (with JAVA SDK).

We created a DynamoDB table with a Primary Partition Key 'id', and a Sort Key 'create_time'. And I used query operation in my source code with both Partition Key and Sort Key, but I get a exception while querying

com.amazonaws.services.dynamodbv2.model.AmazonDynamoDBException: Query condition missed key schema element: create_time  (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ValidationException; Request ID: K9B8K5DU0CQ1BQA9VJIPTI6EIJVV4KQNSO5AEMVJF66Q9ASUAAJG)

I have researched for a day, and almost all the results for searching "Query condition missed key schema element" from google told me that I'm not using the Partition Key or GSI in KeyConditionExpression , but I'm sure that we had set up correct Partition Key and Sort key with correct names and used correct in source code, by the way we didn't create any GSI in out DynamoDB.

So I just want to know that are there any situations which might cause this exception - Query condition missed key schema element with a Sort Key rather than a Partition Key.

**BACKGROUND STATEMENT **

  1. This query operation worked in my develop environment well, but not worked in the production environment. The source code is exactly the same.
  2. This table is new created in production environment. (I ever suspected that there must be something wrong while creating the table in the production environment. But I have confirmed for several times, the Partition Key and Sort Key are all correctly named and we do not create any GSI.)
  3. The differences between develop and production might be the DynamoDB regions. Develop is created in ap-southeast-1 and the production is in us-west-1.
asked 2 years ago6885 views
1 Answer
1

HI Zeko,

Looks like your keys do not match those of the table that you are querying, I can assert this from the RequestId in the exception you shared. Without revealing any resource information in a public forum, I kindly suggest that you ensure your keys match the table which you are querying:

  1. Check you are querying the table you believe it to be in the region you believe it resides.
  2. If the table is correct, check that the keys match, as mentioned keys which you described do not match the table in question.

Please feel free to reach out to AWS Premium Support should the above not assist you, we would be happy to discuss in detail there.

profile pictureAWS
EXPERT
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions