Skip to content

Error in Lambda Invocation

0

Hi, I am seeing the following error intermittently in my Lambda function logs. These Lambdas are configured behind a single API Gateway. I have other Lambda functions in the same VPC and with similar configuration (memory, timeout, etc.) but only this set shows the error below. Despite the error, I haven’t noticed any impact on functionality, but it keeps appearing in the logs:

2025-07-08T15:45:05.978Z Exception in thread "main" java.lang.Error: lambdainternal.runtimeapi.LambdaRuntimeClientException: Failed to get next. Response code: '-1'.
2025-07-08T15:45:05.978Z at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:199)
2025-07-08T15:45:05.978Z at lambdainternal.AWSLambda.main(AWSLambda.java:186)
2025-07-08T15:45:05.978Z Caused by: lambdainternal.runtimeapi.LambdaRuntimeClientException: Failed to get next. Response code: '-1'.
2025-07-08T15:45:05.978Z at lambdainternal.runtimeapi.NativeClient.next(Native Method)
2025-07-08T15:45:05.978Z at lambdainternal.runtimeapi.LambdaRuntimeClient.waitForNextInvocation(LambdaRuntimeClient.java:47)
2025-07-08T15:45:05.978Z at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:249)
2025-07-08T15:45:05.978Z at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:197)

Additionally, the original error in the logs is:

2025-07-10T09:23:03.171Z [ERROR] [1752139383171] LAMBDA_RUNTIME Failed to get next invocation. No Response from endpoint

What I’ve tried so far:

  1. Increased memory to 2GB and set the timeout to the maximum.
  2. Enabled Provisioned Concurrency, but the error still occurs.
  3. Verified VPC configuration (other Lambdas in the same VPC do not have this issue).

Function details:

  1. The Lambda handler is very simple: it fetches a record from DynamoDB.
  2. DynamoDB client is created as follows:
private static DynamoDbClient buildDefaultClient() {
    Region region = Region.of(Config.get(SdkSystemSetting.AWS_REGION.environmentVariable()));
    return DynamoDbClient.builder().region(region).build();
}

The handler code just calls:

item = dynamoDbClient.getItem(builder -> builder.tableName(tableName).consistentRead(true).key(key));

No other significant logic is present.

Lambda configuration:

Memory: 2GB

Timeout: Maximum allowed

VPC: Yes (same as other working Lambdas)

API Gateway: Single API Gateway for these functions

Questions:

What does this error mean, and what could be causing it, especially since there is no visible impact on functionality?

Is this something I should be concerned about, or is it safe to ignore if the function is working as expected?

Are there any best practices or additional troubleshooting steps I should follow to resolve or suppress this error?

Any insights or suggestions would be greatly appreciated!

Regards,

Liju

asked a year ago296 views

1 Answer
0

This error appears to be an internal Lambda runtime issue rather than a problem with your specific configuration. The error "Failed to get next. Response code: '-1'" indicates a communication problem between the Lambda function and the Lambda service.

Based on the information provided, since you're not observing any functional impact, this is likely an intermittent issue that occurs during Lambda's internal operations. The error might be happening when the Lambda runtime is trying to get the next invocation but encounters a temporary connectivity issue.

You've already tried several appropriate troubleshooting steps:

  1. Configuring Provisioned Concurrency
  2. Verifying your VPC configuration
  3. Increasing memory allocation
  4. Extending the timeout

Since the error appears intermittently and doesn't affect functionality, it may be related to how Lambda handles certain edge cases during invocation. When Lambda functions are invoked through API Gateway, API Gateway treats invocation errors as internal errors, but since you're not seeing functional impact, these errors might be occurring outside the actual request processing.

If the errors continue to appear in your logs but don't impact functionality, you might want to implement additional logging to determine if these errors correlate with specific events or traffic patterns. You could also consider reaching out to AWS Support with these logs if the errors become more frequent or start affecting your application's performance.
Sources
Handling Lambda errors with an API Gateway API - AWS Lambda
Troubleshoot invocation issues in Lambda - AWS Lambda

answered a year ago

AWS
SUPPORT ENGINEER

reviewed a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.