Hi,
Not sure if this is an error … but the behavior is surprising, so I thought I’d report it.
handleSesSuppressions:
handler: handleSesSuppressions.handler
events:
- sns:
arn: ${{self:resources.Outputs.BouncesSnsTopic.Value}}
topicName: ${{file(./commonResources/serverless.yml):provider.environment.BouncesSnsTopic}}
- sns:
arn: ${{self:resources.Outputs.ComplaintsSnsTopic.Value}}
topicName: ${{file(./commonResources/serverless.yml):provider.environment.ComplaintsSnsTopic}}
This deploys. As seen in cloudformation-template-update-stack.json
:
"HandleSesSuppressionsSnsSubscriptionIrhsesbounces": {
"Type": "AWS::SNS::Subscription",
"Properties": {
"TopicArn": {
"Fn::Sub": "arn:aws:sns:${AWS::Region}:${AWS::AccountId}:irh-ses-bounces"
},
"Protocol": "lambda",
"Endpoint": {
"Fn::GetAtt": [
"HandleSesSuppressionsLambdaFunction",
"Arn"
]
}
}
},
However, this does not deploy:
handleSesSuppressions:
handler: handleSesSuppressions.handler
events:
- sns: ${{self:resources.Outputs.BouncesSnsTopic.Value}}
- sns:
arn: ${{self:resources.Outputs.ComplaintsSnsTopic.Value}}
topicName: ${{file(./commonResources/serverless.yml):provider.environment.ComplaintsSnsTopic}}
Produces this error message:
Missing or invalid topicName property for sns event
in function "handleSesSuppressions" The correct syntax
is: sns: topic-name-or-arn OR an object with arn and
topicName OR topicName and displayName. Please check
the docs for more info.
It seems like I am meeting the requirements for using a pre-existing SNS topic by not including the Topic Name:
Which seems redundant, since it’s included in the ARN:
BouncesSnsTopic:
Description: SNS topic to receive SES bounces.
Value:
Fn::Sub: arn:aws:sns:${AWS::Region}:${AWS::AccountId}:${{file(./commonResources/serverless.yml):provider.environment.BouncesSnsTopic}}
Am I reading the documentation incorrectly?
Thanks in advance!