0

I am working on a notification service which is built on AWS infra and uses MSK, lambda and SES. The lambda is written in Nodejs for which the trigger is an MSK topic. Now the weird thing about this lambda is its getting invoked continuously even after the messages are processed. Inside lambda is the code to fetch recipients and send emails via SES.

I have ensured that there is no loop present inside the code. so my guess is for some reason the messages are not getting marked as consumed.

One reason this could happen is if the code executing throws an Error at some point. But I have no error in the logs.

Can execution time (lambda getting timed out be an issue? I don't see anything like that in the logs though), the volume of messages be responsible for this behavior ?

Lambda is setup using serverless framework:

notificationsKafkaConsumer:
    handler: src/consumers/notifications.consumer
    events: 
      - msk: 
          arn: ${ssm:/kafka/cluster_arn~true}
          topic: "notifications"
          startingPosition: LATEST
arpit
  • 51
  • 1
  • 3
  • There isn't any code inside the lambda which acknowledges the consumption of messages. However other lambdas setup with same configuration seems to work just fine and messages are not consumed endlessly with them. – arpit Sep 15 '21 at 16:36

1 Answers1

0

It turned out that the lambdas getting timeout out was the issue. The message got lost in the huge volume of logs and interestingly "timed out" is not an error so filtering logs with "ERROR" didn't work.

arpit
  • 51
  • 1
  • 3
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-ask). – Community Sep 16 '21 at 14:37