serverless-plugins
serverless-plugins copied to clipboard
Offline SQS only seems to run jobs when first ran
Hi guys
I'm working on SQS locally using the serverless-offline-sqs. All works swimmingly on the initial run and any jobs in the queue will run straight away or if no jobs are in the queue the first one I fire off will get processed
But if I add more jobs to the queue they don't get processed unless I restart the whole serverless command.
If anyone has experienced this before please let me know as that would be great.
I was getting this too. My problem was that my handler was not async/returning a promise as I intended it to. The other option being calling the callback function. In other words your sqs lambda should be one of:
exports.handler = function(event, context, callback) { ... callback(); ...}
exports.handler = async function(event) { .... }