Open drizzef opened 4 years ago
I am also facing the same issue. Only one message is reading at the time of start, latter I am pushing data in the queue, but it does not trigger the serverless-ofline-sqs.
hi @AdrieanKhisbe Same thing here, only one message is processed, then following messages don’t trigger the lambda function. This started when moving from serveless-offline 5 to 6+.
UPDATE:
I tracked the issue down the code and discovered that the call to call to async functionlambdaFunction.runHandler()
here https://github.com/CoorpAcademy/serverless-plugins/blob/master/packages/serverless-offline-sqs/src/sqs.js#L87 does not resolve if the lambda function handler returns None (pyhon).
After explicitly returning a value the lambdaFunction.runHandler()
resolves and the plugin can handle a new sqs message event.
As returning None is allowed (cf. https://docs.aws.amazon.com/lambda/latest/dg/python-handler.htm) this is still a bug, but it can be overcame by returning an explicit value. Make sure also to return a value on errors, and not just raise/throw or it will also block.
I tracked the bug down in serverless-offline plugin and the async handler blocks here https://github.com/dherault/serverless-offline/blob/master/src/lambda/LambdaFunction.js#L269 when the lambda handler does not return truthy.
However, blocking there seems to be exclusive to the serverless-offline-sqs invoke, as it does not block for explicit lambda invoke. So telling whether the bug is in serverless-offline or serverless-offline-sqs is still to be decided.
Hi,
We are working with a serverless offline SQS plugin and we didn't notice what we did but in offline mode, the lambda stops triggering when there is a message on the queue(we are using Elasicmq on the local environment).
this is the YAML file:
env: test email: smtp: userName: fdsfdsf@dasd.cc password: 123456 defaultAddress: fdfsdfsdf@cc.cc queue: email: region: eu-west-1 accessKeyId: root secretAccessKey: root url: http://localhost:9324/queue/emails serverless-offline: httpPort: 4400 serverless-offline-sqs: autoCreate: true # create queue if not exists apiVersion: "2012-11-05" endpoint: http://0.0.0.0:9324 region: eu-west-1 accessKeyId: root secretAccessKey: root skipCacheInvalidation: false