Lambda: SNS events subscriptions only partially registered

Hello,

I find myself asking about my problem here today because I’ve had an issue for quite a while.
I have a service with a handler function that is subscribed to 22 pre-existing SNS topics (by their ARN) from another stack in the yaml configuration file.

custom
     baseEventName: { Fn::Join: [':', ["arn:aws:sns",Ref: "AWS::Region", Ref: "AWS::AccountId", "event-${opt:stage, self:provider.stage}"]] }
functions:
    onIncomingMessage:
        handler: index.onIncomingMessage
        events:
        - sns:
            arn: { Fn::Join: ['-', ["${self:custom.baseEventName}", "onBusinessUpdated"]] }
            topicName: onBusinessUpdated
        - sns:
            arn: { Fn::Join: ['-', ["${self:custom.baseEventName}", "onBusinessAccountCompleted"]] }
            topicName: onBusinessAccountCompleted
....

When I deploy the service, CloudFormation shows that everything went fine, I do have the 22 events subscriptions created as resources in the stack but when I check the lambda triggers list, I only see 18 instead of 22.

So I was wondering if this issue was known (although I didn’t find anything like that) or was I just doing something that wasn’t supposed to be?

I can still add the subscriptions manually but it would be extremly annoying when adding new events and redeploying…

1 Like

I’m having a very similar issue. Did you ever figure out what was going on here?

Sadly I haven’t, we dropped using serverless along the way to switch to terraform.

If you want a bit more details, there was an issue thread I created on the Serverless repo, maybe something in it would help you more

Good luck :slight_smile:

1 Like