Skip to content

(aws-sns-subscriptions): Numeric values are not supported on the filterPolicy prop #16549

@raducastravet

Description

@raducastravet

When trying to create a lambda subscription with the filterPolicy param that contains a numericFilter, the deployment fails.
Error: Invalid parameter: FilterPolicy: Empty arrays are not allowed.

Reproduction Steps

Create the lambda subscription with the filterPolicy with an amount field and the value of SubscriptionFilter.numericFilter

const listener = new LambdaSubscription(handler, {
  filterPolicy: {
    Amount: SubscriptionFilter.numericFilter({
      lessThan: 0
    })
  }
})

The cdk generates the following piece of json template

"FilterPolicy": {
  "Amount": [],
}

What did you expect to happen?

We expected that the code would deploy successfully

We were trying to add a new numeric filter on the subscription for negative amounts.

What actually happened?

The deployment of the code failed.

Environment

  • CDK CLI Version: 1.123.0
  • Node.js Version: v14.17.5
  • OS: MacOS Big Sur 11.5.2
  • Language (Version): TypeScript (6.14.14)

Other

Invalid parameter: FilterPolicy: Empty arrays are not allowed
at [Source: (String)"{"Amount":[]}"; line: 1, column: 41] (Service: AmazonSNS; Status Code: 400; Error Code: InvalidParameter; Request ID: 73cf8abd-9eb5-5c6c-8f74-d37fad989b6a; Proxy: null)


This is 🐛 Bug Report

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions