3030 SnsStore ,
3131 SnsSubscription ,
3232)
33+ from localstack .services .sns .v2 .utils import get_topic_subscriptions
3334from localstack .utils .aws .arns import (
3435 PARTITION_NAMES ,
3536 extract_account_id_from_arn ,
@@ -1009,7 +1010,10 @@ def create_sns_message_body(
10091010 # FIFO topics do not add the signature in the message
10101011 if not subscriber .get ("TopicArn" , "" ).endswith (".fifo" ):
10111012 signature_version = (
1012- topic_attributes .get ("signature_version" , "1" ) if topic_attributes else "1"
1013+ # we allow for both casings, depending on v1 or v2 provider
1014+ topic_attributes .get ("signature_version" , topic_attributes .get ("SignatureVersion" , "1" ))
1015+ if topic_attributes
1016+ else "1"
10131017 )
10141018 canonical_string = compute_canonical_string (data , message_type )
10151019 signature = get_message_signature (canonical_string , signature_version = signature_version )
@@ -1234,7 +1238,7 @@ def _should_publish(
12341238 )
12351239
12361240 def publish_to_topic (self , ctx : SnsPublishContext , topic_arn : str ) -> None :
1237- subscriptions = ctx .store . get_topic_subscriptions ( topic_arn )
1241+ subscriptions = get_topic_subscriptions ( ctx .store , topic_arn )
12381242 for subscriber in subscriptions :
12391243 if self ._should_publish (ctx .store .subscription_filter_policy , ctx .message , subscriber ):
12401244 notifier = self .topic_notifiers [subscriber ["Protocol" ]]
@@ -1249,7 +1253,7 @@ def publish_to_topic(self, ctx: SnsPublishContext, topic_arn: str) -> None:
12491253 self ._submit_notification (notifier , ctx , subscriber )
12501254
12511255 def publish_batch_to_topic (self , ctx : SnsBatchPublishContext , topic_arn : str ) -> None :
1252- subscriptions = ctx .store . get_topic_subscriptions ( topic_arn )
1256+ subscriptions = get_topic_subscriptions ( ctx .store , topic_arn )
12531257 for subscriber in subscriptions :
12541258 protocol = subscriber ["Protocol" ]
12551259 notifier = self .batch_topic_notifiers .get (protocol )
0 commit comments