Skip to content

aws-lambda: FilterRule.null() returns empty array #31458

@ujjwol05

Description

@ujjwol05

Describe the bug

According to the documentation here, the FilterPattern should be [null]. However, the function FilterRule.null() currently returns an empty array [] instead.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

The filter pattern for null should be
{ "eventName": [ "INSERT" ], "dynamodb": { "NewImage": { "test": { "S": [ null ] } } } }

Current Behavior

The filter pattern currently being returned is
{ "eventName": [ "INSERT" ], "dynamodb": { "NewImage": { "test": { "S": [] } } } }

Reproduction Steps

Construct an EventSourceMapping

new lambda.EventSourceMapping(
            this,
            `${stackPrefix}-lambda-event-source-mapping`,
            {
                startingPosition: StartingPosition.TRIM_HORIZON,
                target:XXXX,
                eventSourceArn: XXXX,
                reportBatchItemFailures: true,
                filters: [
                    lambda.FilterCriteria.filter({
                        eventName: lambda.FilterRule.isEqual('INSERT'),
                        dynamodb: {
                            NewImage: {
                                test: { S: lambda.FilterRule.exists() },
                            },
                        },
                    }),
                ],
            }
        );

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.155.0

Framework Version

No response

Node.js Version

v20.11.0

OS

Sonoma

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-lambdaRelated to AWS LambdabugThis issue is a bug.effort/mediumMedium work item – several days of effortp1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions