serverless-plugins
serverless-plugins copied to clipboard
Feature Idea: Enhance autoCreate to create dead letter queues and redrive policies.
Thank you so much for your hard work on this project! 🎉 It has made it really easy to work with SQS offline. I recently upgraded to v2. The autoCreate functionality works really well. I was able to replace a shell script that used the AWS cli to create queues. The only gap I have is dead letter queue (DLQ) support.
Current state: autoCreate scans the lambda event sources for SQS events. Queues are built for each event source.
Proposed state: Optionally(?) scan the resources section to see if CloudFormation templates exist for SQS. If so, generate DLQs first then add the main queues with redrive policies.
This may likely be outside the indented scope of this module. No worries if you aren’t interested in supporting it! 🤓
Hello! Is it possible to contribute to this issue? If so, do you have any contributing guidelines?
here's a PR to allow auto-creating queues when you don't actually want to handle those events in a lambda:
https://github.com/CoorpAcademy/serverless-plugins/pull/172/files
functions:
doStuffAsync:
handler: src/handlers/doStuffAsync.handler
events:
- sqs:
arn:
Fn::GetAtt:
- FifoQueue
- Arn
# this is for hacking serverless-offline-sqs to auto-create the DLQ for local development
offlineAsync:
handler: src/handlers/offlineAsync.handler
events:
- sqs:
enabled: false
arn:
Fn::GetAtt:
- DeadLetterFifoQueue
- Arn
it's a little hacky, i know, but it gets the job done
Right! I did the same as a workaround, I created a "fake" consumer just to make the lib create the DLQ. I wonder why you needed to make code changes for that! I'll review the PR!
I needed the code changes to ensure that the fake consumer handler didn't actually consume messages off of SQS, because my use case requires consuming them in a long-running process outside of the serverless stack.