aws / aws/aws-cdk

(sns): No way to add anything-but with prefix twice

Open
#20,483 13 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-sns bug p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
74

Description

### Describe the bug

Today is not possible to filter out messages using anything-but with more than one prefix.
So I tried to filter out by using two anything-but objects like this:

```
{
"documentId": [
{
"anything-but": {
"prefix": "aPrefix"
}
},
{
"anything-but": {
"prefix": "APREFIX"
}
}
]
}
```
Also with no success.

### Expected Behavior

I expected that messages with both prefixes would be filtered out.

### Current Behavior

Only messages with "aPrefix" are filtered out.

If there is any way to accomplish that today let me know please!

### Reproduction Steps

Added subscription to a SNS with the described filtering options

### Possible Solution

Ideally I would like to do:
```
{
"documentId": [ { "anything-but": { "prefix": ["aPrefix","APREFIX"] } }]
}
```
or something similar.

### Additional Information/Context

_No response_

### CDK CLI Version

2.x

### Framework Version

_No response_

### Node.js Version

12

### OS

linux

### Language

Typescript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the AWS SNS subscription filter behavior with the provided anything-but prefix policies and inspect the CDK SNS filter-policy implementation. Confirm whether multiple prefixes can be represented, then ensure the requested policy excludes messages matching both prefixes and add regression coverage for the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.