Skip to content

bug: Incorrect result in SQS after processing by InputTransformer or Input in EventBridge Rules #12195

Closed
@maksymhopei

Description

@maksymhopei

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Setup

  • S3 Bucket with enabled notifications to EventBridge
  • EventBridge Rule:
    • reacts to S3 Bucket object events
    • transforms the event using InputTransformer or Input
    • sends transformed event to a SQS FIFO queue (FIFO may be irrelevant, this was just a setup I tested against)

Example InputTransformer config

InputPathMap:

{"objectKey": "$.detail.object.key"}

InputTemplate:

{"Key":<objectKey>}

Example Input config

{"Key":"test-key"}

Resulting message in the SQS:

"{Key:test-key}"

The message string includes the outer quotes and none of the inner quotes.
If the transformer is not applied the original S3 message appears in SQS correctly (a correct JSON string).

Expected Behavior

I'm expecting a properly formatted JSON string without outer quotes:

{"Key":"test-key"}

How are you starting LocalStack?

With a docker-compose file

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

docker run localstack/localstack

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

awslocal sqs create-queue --queue-name test-queue.fifo --region eu-central-1 --attributes FifoQueue=true,ContentBasedDeduplication=true

awslocal s3 mb s3://test-bucket
awslocal s3api put-bucket-notification-configuration --bucket test-bucket \
  --notification-configuration '{"EventBridgeConfiguration": {}}'

awslocal events put-rule --name "ForwardObjectCreationEventToSqsQueue" \
  --event-pattern '{
 "source": ["aws.s3"],
 "detail-type": ["Object Created"],
 "detail": {
   "bucket": {
     "name": ["test-bucket"]
   }
 }
}'

awslocal events put-targets --rule "ForwardObjectCreationEventToSqsQueue" \
  --targets '[
  {
    "Id": "test-target",
    "Arn": "arn:aws:sqs:eu-central-1:000000000000:test-queue.fifo",
    "InputTransformer": {
      "InputPathsMap": {
        "objectKey": "$.detail.object.key"
      },
      "InputTemplate": "{\"Key\":<objectKey>}"
    },
    "SqsParameters": {
      "MessageGroupId": "test-group-id"
    }
  }
]'

Environment

- OS:
- LocalStack:
  LocalStack version:
  LocalStack Docker image sha:
  LocalStack build date:
  LocalStack build git hash:

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions