Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cross-account/cross-regions SNS subscriptions to topics with the same name #6445

Merged
merged 5 commits into from
Jul 26, 2019

Conversation

zvymazal
Copy link
Contributor

@zvymazal zvymazal commented Jul 25, 2019

What did you implement:

Closes #6444

How did you implement it:

If Lambda function subscribes to multiple topics with the same name allow defined topicName to take precedence when creating CloudFormation resources and to prevent resource name collisions.

How can we verify it:

Configure two topics with the same name in two different accounts (or in two different regions):

functions:
  hello:
    handler: handler.run
    events: 
      - sns: 
        arn: arn:aws:sns:us-east-1:00000000000:topicname
        topicName: topicname-account-1-us-east-1
      - sns: 
        arn: arn:aws:sns:us-east-1:11111111111:topicname
        topicName: topicname-account-2-us-east-1

Deployment should succeed without an error. Check if two CloudFormation resources of type AWS::SNS::Subscription exist and if they have "sanitized" name taken from topicName.

Todos:

Note: Run npm run test-ci to run all validation checks on proposed changes

  • Write tests and confirm existing functionality is not broken.
    Validate via npm test
  • Write documentation
  • Ensure there are no lint errors.
    Validate via npm run lint-updated
    Note: Some reported issues can be automatically fixed by running npm run lint:fix
  • Ensure introduced changes match Prettier formatting.
    Validate via npm run prettier-check-updated
    Note: All reported issues can be automatically fixed by running npm run prettify-updated
  • Make sure code coverage hasn't dropped
  • Provide verification config / commands / resources
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES
Is it a breaking change?: NO

Copy link
Contributor

@pmuens pmuens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this @zvymazal 👍

Could you add a regression test case so that we can be sure to not re-introduce that bug in the future? Thanks!

@pmuens pmuens self-assigned this Jul 25, 2019
Copy link
Contributor

@pmuens pmuens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this @zvymazal 👍

I just tested it and this PR fixes the bug. LGTM :shipit:

@pmuens pmuens added this to the 1.49.0 milestone Jul 26, 2019
@pmuens pmuens merged commit a768e2f into serverless:master Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cross account SNS Trigger
2 participants