From bed6c2a398e0bd5a342e8c2e222b8f0e212e8b1c Mon Sep 17 00:00:00 2001 From: Andreas Knuth Date: Fri, 3 Apr 2026 17:03:14 -0500 Subject: [PATCH] fix --- basic_setup/ses_sns_shim_global.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/basic_setup/ses_sns_shim_global.py b/basic_setup/ses_sns_shim_global.py index 2bf01f0..005172a 100644 --- a/basic_setup/ses_sns_shim_global.py +++ b/basic_setup/ses_sns_shim_global.py @@ -53,7 +53,6 @@ def get_queue_url(domain): raise def publish_to_sns(topic_arn, message_body, msg_id): - """Versucht SNS Publish. Gibt True bei Erfolg, False bei Topic-Not-Found.""" attempt = 0 while attempt < MAX_RETRIES: try: @@ -65,8 +64,9 @@ def publish_to_sns(topic_arn, message_body, msg_id): return True except ClientError as e: error_code = e.response['Error']['Code'] - if error_code == 'NotFound' or error_code == 'NotFoundException': - logger.info(f"ℹ️ SNS Topic not found for {topic_arn} — falling back to SQS") + # Fallback auf SQS bei Topic-nicht-gefunden ODER fehlender Berechtigung + if error_code in ('NotFound', 'NotFoundException', 'AuthorizationError'): + logger.info(f"ℹ️ SNS unavailable for {topic_arn} ({error_code}) — falling back to SQS") return False attempt += 1 logger.warning(f"Retry {attempt}/{MAX_RETRIES} SNS: {error_code}")