Skip to content

bug: EventBridge pattern using suffix generates incorrect rule #11537

@arshsingh

Description

@arshsingh

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I'm trying to create an EventBridge rule using the suffix matcher, with CDK:

new Rule(this, "TestRule", {
  eventPattern: {
    source: ["aws.s3"],
    detailType: ["Object Created"],
    detail: {
      bucket: { name: ["test-s3-bucket"] },
      object: { key: [{ suffix: "/test.json" }] },
    },
  },
  targets: [...],
});

Creating the rule succeeds, but when there is an event it throws an error saying the rule is invalid (somthing like: suffix value must be a string, not an array). Upon further inspection it looks like the rule this ends up creating contains the pattern: { suffix: ["/test.json"] }

However If I change this to prefix, it creates the rule correctly without the array: { prefix: "/test.json" }

Expected Behavior

In the rule created by cloudformation the value"/test.json" should not be inside an array

How are you starting LocalStack?

With a docker-compose file

Steps To Reproduce

  • create an evenbridge rule using CDK/cloudformation and use the suffix matcher in the event pattern
  • call awslocal events describe-rule --name {rule name here}
  • the EventPattern in the rule will have the suffix value inside an array

Environment

- OS: Mac OS 14
- LocalStack:
  LocalStack version: 3.7.2
  LocalStack Docker image sha: sha256:6121fe59d0c05ccc30bee5d4f24fce23c3e3148a4438551982a5bf60657a9e8d
  LocalStack build date: 2024-09-06
  LocalStack build git hash: 854016a0

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions