Skip to content

Help wanted with DynamoDbItemEncryptorException: Configuration mismatch partition or sort key does not exist in item. #393

@motica1

Description

@motica1

Hi,
I am observing an error software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.model.DynamoDbItemEncryptorException: Configuration mismatch partition or sort key does not exist in item. during reading from a global secondary index. The query operation returns successfully, but during reading the returned response the above mentioned error occurs.

Here is everything that i verified:

  • Table config includes plaintextOverride(PlaintextOverride.FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ)
  • Table description looks accurate
{
    "Table": {
        "AttributeDefinitions": [
            {
                "AttributeName": "pk",
                "AttributeType": "S"
            },
            {
                "AttributeName": "sk",
                "AttributeType": "S"
            },
            {
                "AttributeName": "gsi1_sk",
                "AttributeType": "S"
            },
            {
                "AttributeName": "gsi2_sk",
                "AttributeType": "S"
            }
        ],
        "TableName": "pii-details",
        "KeySchema": [
            {
                "AttributeName": "pk",
                "KeyType": "HASH"
            },
            {
                "AttributeName": "sk",
                "KeyType": "RANGE"
            }
        ],
        "TableStatus": "ACTIVE",
        "CreationDateTime": "2023-09-07T14:48:44.776000-04:00",
        "ProvisionedThroughput": {
            "LastIncreaseDateTime": "1969-12-31T19:00:00-05:00",
            "LastDecreaseDateTime": "1969-12-31T19:00:00-05:00",
            "NumberOfDecreasesToday": 0,
            "ReadCapacityUnits": 0,
            "WriteCapacityUnits": 0
        },
        "TableSizeBytes": 4524,
        "ItemCount": 4,
        "TableArn": "arn:aws:dynamodb:us-west-2:000000000000:table/pii-details",
        "TableId": "958b7ee0-df96-419d-a378-83fc8e70fca1",
        "BillingModeSummary": {
            "BillingMode": "PAY_PER_REQUEST",
            "LastUpdateToPayPerRequestDateTime": "2023-09-07T14:48:44.776000-04:00"
        },
        "GlobalSecondaryIndexes": [
            {
                "IndexName": "gsi1",
                "KeySchema": [
                    {
                        "AttributeName": "pk",
                        "KeyType": "HASH"
                    },
                    {
                        "AttributeName": "gsi1_sk",
                        "KeyType": "RANGE"
                    }
                ],
                "Projection": {
                    "ProjectionType": "INCLUDE",
                    "NonKeyAttributes": [
                        "identityId",
                        "createdAt",
                        "nickName"
                    ]
                },
                "IndexStatus": "ACTIVE",
                "ProvisionedThroughput": {
                    "ReadCapacityUnits": 0,
                    "WriteCapacityUnits": 0
                },
                "IndexSizeBytes": 4524,
                "ItemCount": 4,
                "IndexArn": "arn:aws:dynamodb:ddblocal:000000000000:table/pii-details/index/gsi1"
            },
            {
                "IndexName": "gsi2",
                "KeySchema": [
                    {
                        "AttributeName": "pk",
                        "KeyType": "HASH"
                    },
                    {
                        "AttributeName": "gsi2_sk",
                        "KeyType": "RANGE"
                    }
                ],
                "Projection": {
                    "ProjectionType": "INCLUDE",
                    "NonKeyAttributes": [
                        "identityId",
                        "createdAt",
                        "nickName"
                    ]
                },
                "IndexStatus": "ACTIVE",
                "ProvisionedThroughput": {
                    "ReadCapacityUnits": 0,
                    "WriteCapacityUnits": 0
                },
                "IndexSizeBytes": 4524,
                "ItemCount": 4,
                "IndexArn": "arn:aws:dynamodb:ddblocal:000000000000:table/pii-details/index/gsi2"
            }
        ],
        "Replicas": []
    }
}
  • Items are correctly populated in the index, snippet below
"Items": [
        {
            "sk": {
                "S": "LATEST#1ff1b931-4a24-46ec-97ec-5ccd54f8ef2a"
            },
            "createdAt": {
                "S": "2023-09-07T18:51:13.634084084Z"
            },
            "pk": {
                "S": "<tenantId>"
            },
            "gsi1_sk": {
                "S": "LATEST#BENEFICIARY"
            },
            "identityId": {
                "S": "1ff1b931-4a24-46ec-97ec-5ccd54f8ef2a"
            },
            "nickName": {
                "S": "nickName"
            }
        },

Can you help me with some direction? Also it would be worth adding some examples for Query and Scan operations for this new encryption client. TIA :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions