Search code examples
amazon-web-servicesaws-lambdaamazon-sqs

SQS Lambda Integration - Lambda does not process the queue message


Currently I'm using SQS - Lambda integration

The concurrency for Lambda is available. SQS batch is set to 1 record, 0 delay.

Visibility timeout for SQS is 15 Minutes, Lambda max exec time is 15 Minutes

I would notice that sometimes SQS Messages are stuck in-flight without being processed by any Lambda at all ( They fall into the dead letter queue after 15 minutes, CloudWatch show no Lambda being invoked with the message )

Has anyone faced the same issue?

I run Lambda inside VPC, if that matters


Solution

  • The Lambda backend polls SQS on your behalf and invokes a Lambda function if a message is returned. If the invocation succeeds the message will be deleted if however the function fails the message will be returned to the queue (or DLQ depending on your redrive policy) after the visibility timeout has expired. Check this blog post.

    Check if you can see any error metrics for the function in Cloudwatch. Your Lambda function might be failing before it gets a chance to run any code. When this happens there's an error metric but no invocation metric/logs and it's most likely due to an incorrect permission.