1

I just trying to test my DLQ for Lambda and I do not undesrtand why messages does not put on it. My code just doing 1 thing throw new Exception("Test");.

The first mistake was understandable, I was trying to do this synchronously using button Test. After that I setup Kinesis and started sending message on it but nothing changed.On monitoring page on CloudWatch metrics I saw that there were several errors in Errors, Availability but there were no errors in DeadLetterErrors.

As for DLQ which was created this is just simple standard queue with no changes in configuration.

Thanks in advance for your help

tcafrin22
  • 59
  • 1
  • 10
  • 1
    Maybe this is an answer, just need someone who will say that it's true https://docs.aws.amazon.com/lambda/latest/dg/retries-on-errors.html. As I understand this won't work with `Kinesis` or `DynamoDB`. Lambda will try to process message until the message will be expired. Am I correct? – tcafrin22 Oct 04 '18 at 07:58
  • Can you share a snippet of your lambdas declaration? What's a trigger? – Nikolay Vetrov Oct 04 '18 at 18:14

2 Answers2

0

Invoke lambda asynchronously like below, using AWS SDK.

$ aws lambda invoke --function-name my-function --invocation-type Event --payload '{ "key": "value" }' response.json { "StatusCode": 202 }

Docs - https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html

Vikash Yadav
  • 713
  • 1
  • 9
  • 29
0
  • Using Kinesis streams to trigger lambda means that you are using synchronous invocation. However, DLQ is only available for asynchronous invocations.
  • The good news is that in November 2019, AWS published new error handling mechanisms for Kinesis and DynamoDB event source.

With this feature, you can configure a destination on failure. This destination can be an SNS topic, SQS queue, another lambda function, or an EventBridge event bus.

For adding this through the console UI,

  1. Go to the lambda function
  2. Click on the Add Destination button
  3. Select Stream invocation
  4. Select on failure condition
  5. Select SQS queue as the destination and point it to the SQS that you want to use like a DLQ.

For adding it through cloudformation, follow this documentation.
I'll provide a basic example for the trigger that you need to attach to your lambda function:

LambdaTrigger:
  Type: AWS::Lambda::EventSourceMapping
  Properties:
    FunctionName: !GetAtt Lambda.Arn
    EventSourceArn: !GetAtt Kinesis.Arn
    DestinationConfig:
      OnFailure:
        Destination: !GetAtt DLQ.Arn
PodGen4
  • 338
  • 4
  • 12
  • What is less clear is how to get the message body (as far as I can see these messages only contain metadata). Do you know how I could do that? – nsandersen Jan 28 '22 at 15:14