I'm using Serverless Framework & serverless-offline plugin to develop serverless web application locally, and trying to test the following procedure.
- User pushes a button, which will call API
- API will invoke Lambda function and it will publish a message to SNS topic
- Several lambda functions subscribing the SNS topic will be invoked
serverless.yml
plugins:
- serverless-offline
- serverless-offline-sns
functions:
publisher:
handler: publisher.main
events:
- http:
path: publish
method: post
cors: true
authorizer: aws_iam
subscriber:
handler: subscriber.main
events:
- sns: test-topic
I tested it on AWS and it worked, but I don't know how to test it locally.
serverless-offline-sns does not support subscription by lambda for now.
serverless-offline-sns supports http, https, and sqs subscriptions. email, email-json, sms, application, and lambda protocols are not supported at this time. https://www.npmjs.com/package/serverless-offline-sns
I think this is a very common use case for serverless & event-driven architecture. How do you test this on local environment?