Skip to content

LambdaToDynamoDB doesn't allow pointInTimeReoverySpecification only #1382

@vicentenoriega

Description

@vicentenoriega

When using LambdaToDynamoDB by passing dynamoTableProps with pointInTimeRecoverySpecification and not pointInTimeRecovery error is thrown.

Reproduction Steps

new LambdaToDynamoDB(this, 'my-dynamo', {
      existingLambdaObj: myLambdaObj,
      tableEnvironmentVariableName: 'DDB_TABLE_NAME',
      dynamoTableProps: {
        partitionKey: { name: 'myPartitionKey', type: AttributeType.STRING },
        sortKey: { name: 'mySortKey', type: AttributeType.NUMBER },
        tableName: my-table-name,
        removalPolicy: RemovalPolicy.Retain,
        deletionProtection: true,
        encryption: TableEncryption.AWS_MANAGED,
        pointInTimeRecoverySpecification: {
           pointInTimeRecoveryEnabled:  true
        },
        billingMode: BillingMode.PAY_PER_REQUEST,
      },
    });

Error Log

ValidationError: pointInTimeRecoverySpecification and pointInTimeRecovery are set. Use pointInTimeRecoverySpecification only. at path [my-stack-path] in aws-cdk-lib.aws_dynamodb.Table

Environment

  • CDK CLI Version :
  • CDK Framework Version: 2.195.0
  • AWS Solutions Constructs Version : 2.86.0
  • OS :
  • Language : TypeScript

Other

By adding pointInTimeRecovery: undefined everything looks working fine.

new LambdaToDynamoDB(this, 'my-dynamo', {
      existingLambdaObj: myLambdaObj,
      tableEnvironmentVariableName: 'DDB_TABLE_NAME',
      dynamoTableProps: {
        partitionKey: { name: 'myPartitionKey', type: AttributeType.STRING },
        sortKey: { name: 'mySortKey', type: AttributeType.NUMBER },
        tableName: my-table-name,
        removalPolicy: RemovalPolicy.Retain,
        deletionProtection: true,
        encryption: TableEncryption.AWS_MANAGED,
        pointInTimeRecovery: undefined,
        pointInTimeRecoverySpecification: {
           pointInTimeRecoveryEnabled:  true
        },
        billingMode: BillingMode.PAY_PER_REQUEST,
      },
    });

It looks like somewhere pointInTimeRecovery is being set by default if it's not part of the dynamoTableProps and since we send pointInTimeRecoverySpecification, both properties are added so the validation error is thrown.

#1300
#1301
#1328 (I added a few comments after a quick look at the code)

Sorry in advance if there is not enough information I'm new user of aws-solutions-constructs. Let me know if you need any more information :)


This is 🐛 Bug Report

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageThe issue or PR still needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions