Skip to content

Why aren't my failed Lambda asynchronous invocation events reaching my on-failure destination or dead-letter queue?

17 minute read
Content level: Intermediate
1

I configured an on-failure destination, an on-success destination, or a dead-letter queue (DLQ) for my AWS Lambda function that's invoked asynchronously. Records don't arrive, records arrive that I don't expect, or I see the DestinationDeliveryFailures, DeadLetterErrors, or AsyncEventsDropped metric in Amazon CloudWatch.

Short description

When a service such as Amazon Simple Storage Service (Amazon S3), Amazon Simple Notification Service (Amazon SNS), or Amazon EventBridge invokes your function asynchronously, Lambda places the event in a queue and processes it later. If the event fails all attempts or expires, Lambda can send a record to an on-failure destination, a DLQ, or both. If the event succeeds, Lambda can send a record to an on-success destination.

A record doesn't arrive for one of these reasons:

  • The event didn't fail in a way that creates a record, or it's still being retried.
  • The configuration doesn't apply to the version or alias that was invoked.
  • Lambda couldn't deliver the record, because of permissions, encryption, an unsupported or missing target, or size limits. Lambda doesn't retry a failed delivery.
  • The calling service never delivered the event to Lambda.

Note: The function DLQ and the destinations in this article apply only to asynchronous invocations. If an event source mapping invokes your function, then Lambda doesn't use them. For Amazon Kinesis, Amazon DynamoDB Streams, and Apache Kafka sources, configure an on-failure destination on the event source mapping. For more information, see Retain discarded batch records for a Kinesis Data Streams event source in Lambda. For Amazon Simple Queue Service (Amazon SQS), configure a dead-letter queue on the source queue. If you try to add a destination to an SQS event source mapping, then you receive the following error: "Unsupported DestinationConfig parameter for given event source mapping type."

Resolution

Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version. In the commands in this article, replace my-function, prod, my-bus, my-bucket, my-queue-url, my-topic, sns-invoke, alerts, 111122223333, and the Region with your own values.

Check the metrics first

In the CloudWatch console, open the AWS/Lambda namespace. View the following metrics for your function with the Sum statistic at a 1-minute period:

What you seeWhat it means
DestinationDeliveryFailures is above 0Lambda created a record but couldn't deliver it. See the configuration, permission, and size sections of this article. For a denied delivery, this is the only metric that changes.
DeadLetterErrors is above 0Lambda couldn't send the event to the DLQ, and then deleted the event.
AsyncEventsDropped is above 0The event used up its retries or its maximum event age, reserved concurrency is 0, or Lambda stopped a recursive loop. This metric counts every final failure, even when Lambda also sent the event to a destination or DLQ.
Throttles and AsyncEventAge rise togetherLambda is retrying throttled events, and the events might expire before they run.
RecursiveInvocationsDropped is above 0Lambda stopped a recursive loop.
Errors is 0 and no other metric changedThe function didn't report an error for this event. See the next section.

Confirm that the event qualifies for a record

  1. Confirm that the invocation was asynchronous. A synchronous invocation returns the error to the caller and doesn't send anything to a destination or DLQ. By default, Amazon API Gateway invokes functions synchronously. When you choose Test in the Lambda console, Lambda also invokes your function synchronously. To invoke your function asynchronously, run the following command:

    aws lambda invoke --function-name my-function --invocation-type Event --cli-binary-format raw-in-base64-out --payload '{"key": "value"}' response.json

    A successful asynchronous request returns status code 202.

  2. Confirm that the function raised an error. Lambda sends a record to the on-failure destination for an unhandled exception, a timeout, an out-of-memory error, or another runtime error. If your code catches the exception and returns a value, even a value such as {"statusCode": 500}, then the invocation succeeds.

  3. Wait for all retries. By default, Lambda retries a failed invocation two more times, with about 1 minute before the first retry and 2 minutes before the second retry. Lambda creates the on-failure record only after the last attempt fails. To create the record after the first failure, set MaximumRetryAttempts to 0.

  4. Check the condition field of the records that you do receive:

conditionCauseapproximateInvokeCountresponsePayload
SuccessThe function returned without an error.Number of attempts that ranThe function's return value
RetriesExhaustedEvery attempt failed.Number of attempts that ranThe error, for example Sandbox.Timedout or Runtime.OutOfMemory
EventAgeExceededThe event expired before it could run, usually because of throttling.0Absent
ZeroReservedConcurrencyReserved concurrency is 0, so Lambda didn't run the function.0Absent
RecursiveInvocationLambda stopped a recursive loop.0Absent

Note: For timeouts and out-of-memory errors, responseContext.statusCode is still 200. To see the error, check responseContext.functionError and responsePayload.

Confirm that the configuration applies to the invoked version or alias

Destination configuration belongs to one version or alias and isn't inherited. A configuration on $LATEST applies only to unqualified invocations. A configuration on an alias doesn't apply when you invoke the version directly. Run the following command for each qualifier that your callers use:

aws lambda get-function-event-invoke-config --function-name my-function --qualifier prod

If the qualifier has no configuration, then the command returns ResourceNotFoundException.

Also check for the following issues:

  • put-function-event-invoke-config replaces the whole configuration. If you leave out a setting, then Lambda removes it. For example, if you run put with only --maximum-event-age-in-seconds, then Lambda deletes the existing destinations. To change one setting and keep the others, use update-function-event-invoke-config. The update command returns ResourceNotFoundException when the qualifier has no configuration yet, so use put the first time.
  • Each qualifier has one on-success and one on-failure destination. A new on-failure destination replaces the previous one. To send records to several targets, use an EventBridge event bus as the destination, and then create a rule for each target.
  • If an AWS Serverless Application Model (AWS SAM) function uses AutoPublishAlias, then AWS SAM attaches EventInvokeConfig to the alias only. Invocations of the unqualified function name don't use the destinations.
  • You can add or remove the function DLQ only at the function level. Versions use the same DLQ settings as $LATEST.
  • Lambda durable functions don't support destinations. To capture failed invocations of a durable function, configure a DLQ. Also, you must invoke durable functions with a version, alias, or $LATEST. For more information, see Invoking durable Lambda functions.

Resolve destination configuration errors

Lambda validates most destinations when you save the configuration. The following table shows the errors that you might receive, and the cases that Lambda accepts but can't deliver to:

IssueResult
Amazon SQS FIFO queueRejected: "The provided destination config ... is invalid." The error doesn't mention FIFO. Use a standard queue.
Amazon SNS FIFO topicRejected: "FIFO-type Amazon SNS topics aren't supported as a destination."
Amazon S3 bucket as an on-success destinationRejected. Amazon S3 is supported only as an on-failure destination.
S3 bucket ARN with a prefix, for example arn:aws:s3:::my-bucket/failures/Rejected: "The function execution role does not have permissions to call ListBucket on S3," even when the role allows s3:ListBucket. Use the bucket ARN without a prefix. Lambda writes the objects under aws/lambda/async/function-name/.
SQS queue in a different AWS RegionRejected: "The provided destination config ... is invalid."
SQS queue, SNS topic, EventBridge event bus, or Lambda function in a different AWS accountSupported when both the execution role and the target's resource-based policy allow the action. Without the grant on the target, Lambda rejects the configuration. For an SQS queue, the error is "The destination ARN ... is invalid." For other targets, the error is "The function execution role does not have permissions to call ...".
The same version or alias as the functionRejected: "You can't specify the function as a destination for itself." Lambda accepts a different version or alias of the same function, so make sure that you don't create a loop.
SQS queue, SNS topic, or Lambda function that doesn't existRejected: "The destination ARN ... is invalid."
S3 bucket that doesn't existRejected: "Error occurred while ListBucket. S3 Error Code: 404 Not Found"
EventBridge event bus that doesn't existAccepted. Records are silently lost, and DestinationDeliveryFailures doesn't increase. To verify the bus, run aws events describe-event-bus --name my-bus.
Destination deleted after you configured itLambda keeps the configuration. Every delivery fails, and DestinationDeliveryFailures increases.

Important: Don't use the resource that invokes your function as its destination or DLQ. If you do, then you create a recursive loop.

Resolve permission errors

The function's execution role must allow Lambda to write to the destination or DLQ. Lambda checks the permissions when you save the configuration. If a permission is missing, then you receive an error similar to the following: "The function execution role does not have permissions to call SendMessage on arn:aws:sqs:..."

TargetRequired permissions on the execution role
SQS standard queue (destination or DLQ)sqs:SendMessage
SNS standard topic (destination or DLQ)sns:Publish
S3 bucket (on-failure destination)s3:ListBucket on the bucket ARN and s3:PutObject on the objects, arn:aws:s3:::my-bucket/*
Lambda function (destination)lambda:InvokeFunction
EventBridge event bus (destination)events:PutEvents

Lambda doesn't check the permissions again after you save the configuration. If a permission is removed or denied later, then every delivery fails, and the only signal is DestinationDeliveryFailures. Check for denies outside the role's policies:

  • A permissions boundary on the execution role. If the boundary doesn't allow the action, then you receive the same error when you save the configuration. If you add the boundary later, then deliveries fail.
  • Service control policies (SCPs) in AWS Organizations can also block the action.

Encrypted destinations

For SQS and SNS destinations, Lambda doesn't check AWS Key Management Service (AWS KMS) permissions when you save the configuration. A missing KMS permission appears only as DestinationDeliveryFailures. For an S3 bucket that uses a KMS key, Lambda rejects the configuration with the following misleading error: "The function execution role does not have permissions to call PutObject on S3."

Destination encryptionAdditional permissions on the execution role
SQS queue with a customer managed keykms:GenerateDataKey
SNS topic with a customer managed keykms:GenerateDataKey and kms:Decrypt
S3 bucket with a KMS keykms:GenerateDataKey
SQS queue or SNS topic with the AWS managed key, aws/sqs or aws/sns, in the same accountNone

If the key policy doesn't allow IAM policies to grant access to the key, then add the execution role to the key policy.

Resolve payload size issues

The record contains the original event (requestPayload) and the function's response (responsePayload). An asynchronous event can be up to 1 MB, so a record can be larger than the destination accepts. In testing as of October 2026, Lambda delivered the following record sizes in full:

DestinationLargest record delivered in full
Amazon SQSAbout 1 MB, when the queue's MaximumMessageSize is 1,048,576 bytes. New queues use this value by default. Older queues might be set lower.
Amazon EventBridgeAt least 900 KB in testing
AWS LambdaAt least 900 KB in testing
Amazon SNSAbout 256 KB, even when you raise the topic's MaximumMessageSize to 1 MiB

To check an SQS queue, run the following command:

aws sqs get-queue-attributes --queue-url my-queue-url --attribute-names MaximumMessageSize

When a record is too large, Lambda still delivers it. Lambda removes responsePayload, and also requestPayload if the record is still too large. Then, Lambda adds a deliveryError field, for example:

"deliveryError": {"statusCode": 413, "errorCode": "RequestEntityTooLargeException", "errorMessage": "The total destination payload is too large. RequestPayload size: 400000 bytes, ResponsePayload size: 33 bytes"}

Make sure that your consumer handles records without requestPayload. To keep the full event, use an SQS or EventBridge destination, or store large payloads in Amazon S3 and pass a reference.

A DLQ works differently. If the event doesn't fit in the DLQ, then Lambda deletes the event and increases DeadLetterErrors.

Resolve throttled and expired events

When Lambda can't run your function because of throttling (429) or system errors (500-series), Lambda returns the event to the queue and retries it for up to 6 hours by default. The retry interval increases from 1 second to a maximum of 5 minutes. These retries are separate from MaximumRetryAttempts, which applies to function errors.

If the event is still waiting when it reaches MaximumEventAgeInSeconds (60 to 21,600 seconds), then Lambda drops it and sends an EventAgeExceeded record to the on-failure destination or the event to the DLQ. Lambda can send the record before the maximum age fully elapses.

To troubleshoot, complete the following steps:

  1. Compare Throttles, AsyncEventAge, and ConcurrentExecutions for the function. A rising AsyncEventAge with Throttles means that the function doesn't have enough concurrency for the event rate.
  2. Check the function's reserved concurrency. If reserved concurrency is set too low, then raise it. If reserved concurrency is 0, then Lambda doesn't retry. Lambda sends new events straight to the on-failure destination or DLQ with the condition ZeroReservedConcurrency.
  3. Check whether other functions in the account and Region use the available concurrency. To protect a function, reserve concurrency for it. For more information, see Configuring reserved concurrency for a function.
  4. If old events have no value, then lower MaximumEventAgeInSeconds so that Lambda sends them to the on-failure destination sooner.

Resolve recursive loop stops

If your function writes to the same SQS queue, SNS topic, S3 bucket, or EventBridge custom event bus that invokes it, then you can create a recursive loop. Lambda also detects loops made only of Lambda functions. When the same chain of requests invokes your function about 16 times, Lambda stops the loop. If you configured an on-failure destination or DLQ, then Lambda sends the event there with the condition RecursiveInvocation. RecursiveInvocationsDropped increases, and you receive an AWS Health Dashboard notification and an email.

To troubleshoot, complete the following steps:

  1. Find the loop. Check which resources your function writes to, and compare them with the function's triggers and its destination or DLQ.

  2. Fix the design so that the function doesn't write back to its own trigger.

  3. If your design intentionally uses recursion, then you can allow it with the following command:

    aws lambda put-function-recursion-config --function-name my-function --recursive-loop Allow

    Note: It's a best practice to keep the default setting, Terminate. When you allow recursion, RecursiveInvocationsDropped isn't emitted, and a loop can use your account's concurrency and increase costs.

Lambda can't detect loops that include other services, such as Amazon DynamoDB. Lambda also can't detect loops when your function uses an AWS SDK version that's earlier than the minimum version. For more information, see Use Lambda recursive loop detection to prevent infinite loops.

Handle duplicate records

Lambda can process the same asynchronous event more than once, so your function and your destination can receive the same event more than once. To find the cause, check the request IDs in the function's CloudWatch logs or in the records:

  • Same request ID: The request ID stays the same through all retries of an asynchronous invocation. If the earlier attempts failed or timed out, then the duplicates are Lambda retries. To change the retries, update MaximumRetryAttempts.
  • Different request IDs: The calling service or client sent the event more than once.

Make sure that your function and the consumers of your destination are idempotent. Use requestContext.requestId in the record to detect duplicates. For more information, see How do I prevent duplicate Lambda events?

Check for events that never reached Lambda

If SNS or EventBridge can't invoke your function, for example because the function's resource-based policy doesn't allow the service, then Lambda never receives the event. The function DLQ and destinations get nothing.

  • Amazon SNS: Configure a redrive policy on the SNS subscription. The subscription DLQ receives the SNS message.
  • Amazon EventBridge: Configure a dead-letter queue on the rule target. The DLQ message includes the ERROR_CODE attribute, for example NO_PERMISSIONS, and the ERROR_MESSAGE attribute.

To fix the permission, add a resource-based policy statement that allows the service to invoke the function:

aws lambda add-permission --function-name my-function --statement-id sns-invoke --action lambda:InvokeFunction --principal sns.amazonaws.com --source-arn arn:aws:sns:us-east-1:111122223333:my-topic

Check the destination target

  • DLQ and on-failure destination together: Lambda sends every failed event to both. The DLQ message body is the original event only, with the error in the RequestID, ErrorCode, and ErrorMessage message attributes. The on-failure destination receives the full invocation record.
  • Lambda function as a destination: Lambda invokes the destination function asynchronously. The destination function has its own retries and its own destinations. Check its Errors metric and its on-failure configuration.
  • EventBridge event bus as a destination: The event has "source": "lambda" and the detail-type Lambda Function Invocation Result - Success or Lambda Function Invocation Result - Failure. The invocation record is in detail. Make sure that a rule on the bus matches this pattern.

Note: A function in a virtual private cloud (VPC) doesn't need a NAT gateway or a VPC endpoint to deliver records. Lambda delivers records from outside the function's VPC.

Set alarms to detect lost records

Lambda attempts each delivery once. If the delivery fails, then Lambda doesn't retry it, even after you fix the cause. Create alarms on DestinationDeliveryFailures and DeadLetterErrors. Don't use Errors for this purpose, because Errors counts every failed attempt, including attempts that succeed on a later retry.

aws cloudwatch put-metric-alarm --alarm-name my-function-destination-delivery --namespace AWS/Lambda --metric-name DestinationDeliveryFailures --dimensions Name=FunctionName,Value=my-function --statistic Sum --period 60 --evaluation-periods 1 --threshold 0 --comparison-operator GreaterThanThreshold --treat-missing-data notBreaching --alarm-actions arn:aws:sns:us-east-1:111122223333:alerts

Contact AWS Support

If you still can't find the cause after you complete the preceding steps, then open a case with AWS Support. Provide the following information:

  • The function ARN, and the version or alias that was invoked.
  • The service that invoked the function.
  • The request IDs, and the exact time window in UTC.
  • The output of get-function-event-invoke-config and the function's DLQ configuration.
  • The records or DLQ messages, including the DLQ message attributes.
  • The CloudWatch metrics for the time window: Invocations, Errors, Throttles, AsyncEventsReceived, AsyncEventAge, AsyncEventsDropped, DestinationDeliveryFailures, and DeadLetterErrors.

Related information