Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"LAMBDA_RUNTIME" Error on high-volume Lambda Function

I'm currently using a Lambda Function written in Javascript that is setup with an SQS event source to automatically pull messages from an SQS Queue and do some basic processing on the message contents. I cannot show the code but the summary of the lambda function's execution is basically:

For each message in the batch it receives as part of the event:

  1. It parses the body, which is a JSON string, into a Javascript object.
  2. It reads an object from S3 that is listed in the object using getObject.
  3. It puts a record into a DynamoDB table using put.
  4. If there were no errors, it deletes the individual SQS message that was processed from the Queue using deleteMessage.

This SQS queue is high-volume and receives messages in-bulk, regularly building up a backlog of millions of messages. The Lambda is normally able to scale to process hundreds of thousands of messages concurrently. This solution has worked well for me with other applications in the past but I'm now encountering the following intermittent error that reliably begins to appear as the Lambda scales up:

[ERROR] [#############] LAMBDA_RUNTIME Failed to post handler success response. Http response code: 400.

I've been unable to find any information anywhere about what this error means and what causes it. There appears to be not discernible pattern as to which executions encounter it. The function is usually able to run for a brief period without encountering the error and scale to expected levels. But then, as you can see, the error starts to appear quite suddenly and completely destroys the Lambda throughput by forcing it to auto-scale down:

Does anyone know what this "LAMBDA_RUNTIME" error means and what might cause it? My Lambda Function runtime is Node v12.

like image 662
Maltor Avatar asked Mar 26 '20 20:03

Maltor


People also ask

How do you troubleshoot Lambda errors?

To troubleshoot Lambda code errors You can use CloudWatch to view all logs generated by your function's code and identify potential issues. For more information, see Accessing Amazon CloudWatch Logs for AWS Lambda.

What happens if Lambda it runs for more than 15 minute?

Although you can define the timeout property for AWS lambda, but that can not exceed 15 minutes. As per you use case better to use EC2 for deploying you application and then terminate the EC2 instance when the processing is done or it remains idle more than the threshold time.

How do you throw error in Lambda function?

Here is the proper way to throw, catch, and format errors that are generated in a lambda function with serverless. The trick is to create a modified callback which gets passed into the graphQL Handler. When the function gets resolved, it will run through any code that you want.

How do I increase Lambda disk space?

Setting Larger Ephemeral Storage for Your Lambda Function To configure your Lambda function with larger ephemeral storage, choose the Configuration tab under the General Configuration section in the AWS Lambda Console. You will see a new configuration for Ephemeral storage setting at 512MB by default.


1 Answers

I have this error only that I get:
[ERROR] [1638918279694] LAMBDA_RUNTIME Failed to post handler success response. Http response code: 413.

I went to the lambda function on aws console and ran the test with a custom event I build and the error I got there was:

{
    "errorMessage": "Response payload size exceeded maximum allowed payload size (6291556 bytes).",
    "errorType": "Function.ResponseSizeTooLarge"
}

So this is the actual error that cloudwatch doesn't return but the testing section of the lambda function console do.

I think I'll have to return info to an S3 file or something, but that's another matter.

like image 150
Jesus Walker Avatar answered Oct 25 '22 17:10

Jesus Walker