Skip to content

SES: fix infinite loop with SNS event destination #12972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bentsku
Copy link
Contributor

@bentsku bentsku commented Aug 7, 2025

Motivation

While testing an SES/SNS sample, we encountered an issue where sending an email with SES with an SNS event destination configured that would have another SES subscriber, it would trigger an infinite loop.

There were 2 problems:

The following steps required for setting up event publishing are covered in the topics below:

  • You must create a configuration set using the Amazon SES console or API.
  • Add one or more event destinations (CloudWatch, Firehose, Pinpoint, or SNS) to the configuration set, and configure parameters unique to the event destination.
  • When you send an email, you specify which configuration set to use that contains your event destination.

There is still one somewhat big issue because Moto only accepts one EventDestination per configuration set, even if AWS accepts multiple, Moto will overwrite it every time you call CreateConfigurationSetEventDestination, but this is out of scope.

Changes

  • refactor a bit the SNS sending to centralize in one point and not have to modify the code 3 times, and for it to be easy to extend. We will probably need to refactor it again if we want to extend the SNSEmitter and add new kind of destinations
  • add a new LocalStack only test because we cannot really look into received emails when validating against AWS
  • write some TODOs about behavior problem of Event Destinations

@bentsku bentsku added this to the 4.8 milestone Aug 7, 2025
@bentsku bentsku self-assigned this Aug 7, 2025
@bentsku bentsku added aws:ses Amazon Simple Email Service semver: patch Non-breaking changes which can be included in patch releases labels Aug 7, 2025
Copy link

github-actions bot commented Aug 7, 2025

LocalStack Community integration with Pro

  2 files  ±    0    2 suites  ±0   2m 41s ⏱️ - 1h 43m 3s
166 tests  - 4 457  161 ✅  - 4 025  5 💤  - 432  0 ❌ ±0 
168 runs   - 4 457  161 ✅  - 4 025  7 💤  - 432  0 ❌ ±0 

Results for commit 145adce. ± Comparison against base commit 4464cd2.

This pull request removes 4458 and adds 1 tests. Note that renamed tests count towards both.
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_lambda_dynamodb
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_opensearch_crud
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_search_books
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_setup
tests.aws.scenario.kinesis_firehose.test_kinesis_firehose.TestKinesisFirehoseScenario ‑ test_kinesis_firehose_s3
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_destination_sns
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_infra
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_prefill_dynamodb_table
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input0-SUCCEEDED]
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input1-SUCCEEDED]
…
tests.aws.services.ses.test_ses.TestSES ‑ test_ses_sns_topic_integration_send_email_ses_destination

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Aug 7, 2025

Test Results - Preflight, Unit

22 063 tests  ±0   20 329 ✅ ±0   6m 20s ⏱️ +7s
     1 suites ±0    1 734 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit 145adce. ± Comparison against base commit 4464cd2.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Aug 7, 2025

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   3m 17s ⏱️ +5s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit 145adce. ± Comparison against base commit 4464cd2.

Copy link

github-actions bot commented Aug 7, 2025

Test Results (amd64) - Integration, Bootstrap

  5 files    5 suites   11m 56s ⏱️
190 tests 185 ✅  5 💤 0 ❌
196 runs  185 ✅ 11 💤 0 ❌

Results for commit 145adce.

@bentsku bentsku marked this pull request as ready for review August 7, 2025 22:21
@bentsku bentsku requested a review from viren-nadkarni as a code owner August 7, 2025 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws:ses Amazon Simple Email Service semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant