Skip to content

SNS topic subscription not deleted on stack remove #5149

@caulagi

Description

@caulagi

This is a Bug Report

Description

I created a function for handling a SNS event with serverless which created a subscription for the topic. However, when I removed the stack, subscription for the topic was not removed even the topic itself was removed.

$ sls deploy -v
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Creating Stack...
Serverless: Checking Stack create progress...
CloudFormation - CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - sns-test-dev
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_COMPLETE - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_COMPLETE - AWS::CloudFormation::Stack - sns-test-dev
Serverless: Stack create finished...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (42.65 KB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
CloudFormation - UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - sns-test-dev
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - HelloLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - HelloLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - HelloLogGroup
CloudFormation - CREATE_COMPLETE - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Function - HelloLambdaFunction
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Function - HelloLambdaFunction
CloudFormation - CREATE_COMPLETE - AWS::Lambda::Function - HelloLambdaFunction
CloudFormation - CREATE_IN_PROGRESS - AWS::SNS::Topic - SNSTopicSnstest
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Permission - HelloLambdaPermissionSnstestSNS
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Permission - HelloLambdaPermissionSnstestSNS
CloudFormation - CREATE_IN_PROGRESS - AWS::SNS::Topic - SNSTopicSnstest
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - HelloLambdaVersionZRo1gUAuiOGK2Tn3fYC2kBJieXvghZe1LXK15Z1afM
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - HelloLambdaVersionZRo1gUAuiOGK2Tn3fYC2kBJieXvghZe1LXK15Z1afM
CloudFormation - CREATE_COMPLETE - AWS::Lambda::Version - HelloLambdaVersionZRo1gUAuiOGK2Tn3fYC2kBJieXvghZe1LXK15Z1afM
CloudFormation - CREATE_COMPLETE - AWS::Lambda::Permission - HelloLambdaPermissionSnstestSNS
CloudFormation - CREATE_COMPLETE - AWS::SNS::Topic - SNSTopicSnstest
CloudFormation - UPDATE_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - sns-test-dev
CloudFormation - UPDATE_COMPLETE - AWS::CloudFormation::Stack - sns-test-dev
Serverless: Stack update finished...
Service Information
service: sns-test
stage: dev
region: us-east-1
stack: sns-test-dev
api keys:
  None
endpoints:
  None
functions:
  hello: sns-test-dev-hello

Stack Outputs
HelloLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:<redacted>:function:sns-test-dev-hello:2
ServerlessDeploymentBucketName: sns-test-dev-serverlessdeploymentbucket-12mrob9jpkila

$ sls remove -v
Serverless: Getting all objects in S3 bucket...
Serverless: Removing objects in S3 bucket...
Serverless: Removing Stack...
Serverless: Checking Stack removal progress...
CloudFormation - DELETE_IN_PROGRESS - AWS::CloudFormation::Stack - sns-test-dev
CloudFormation - DELETE_IN_PROGRESS - AWS::SNS::Topic - SNSTopicSnstest
CloudFormation - DELETE_SKIPPED - AWS::Lambda::Version - HelloLambdaVersionZRo1gUAuiOGK2Tn3fYC2kBJieXvghZe1LXK15Z1afM
CloudFormation - DELETE_IN_PROGRESS - AWS::Lambda::Permission - HelloLambdaPermissionSnstestSNS
CloudFormation - DELETE_COMPLETE - AWS::SNS::Topic - SNSTopicSnstest
Serverless: Stack removal finished...

What went wrong?

SNS subscription was not removed.

What was the config you used?

service: sns-test

provider:
  name: aws
  runtime: nodejs8.10

functions:
  hello:
    handler: handler.hello
    events:
        - sns: sns-test

Additional Data

  • Serverless Framework Version you're using: 1.28.0
  • Operating System:
  • Stack Trace:
  • Provider Error messages:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions