question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using invoke to call another lambda function always timeout.

See original GitHub issue

Hello,

Apologies if this is not the right place to file this issues. But please let me try to explain my situation.

I have an API Gateway that can successfully call a lambda function. This lambda function base on a certain condition should invoke another lambda function. The code is very simple:

import boto3, json, logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)

client = boto3.client('lambda')

def lambda_handler(event, context):
    raw_event = event.get('body')
    if raw_event.get('event') == "voicecall_final":
        # trigger the next lambda function
        res = client.invoke(
            FunctionName='aggregate',
            InvocationType='RequestResponse',
            Payload=json.dumps({'engagement_id': raw_event.get('engagement_id')})
        )

However I can’t seem to reach other function, the other function is just printing the payload for now. I cannot even get the res variable. Here are the logs:

START RequestId: 21583ec8-a737-11e6-8d5b-a76626b2b591 Version: $LATEST
[INFO]	2016-11-10T11:16:30.994Z	21583ec8-a737-11e6-8d5b-a76626b2b591	Starting new HTTPS connection (1): lambda.us-west-2.amazonaws.com
END RequestId: 21583ec8-a737-11e6-8d5b-a76626b2b591
REPORT RequestId: 21583ec8-a737-11e6-8d5b-a76626b2b591	Duration: 3002.54 ms	Billed Duration: 3000 ms 	Memory Size: 128 MB	Max Memory Used: 22 MB	
2016-11-10T11:16:33.977Z 21583ec8-a737-11e6-8d5b-a76626b2b591 Task timed out after 3.00 seconds

This is running under a VPC and I set the security group to accept all inbound and outbound connection. I use arn:aws:iam::aws:policy/AWSLambdaFullAccess manage role for both of them.

Am I missing something here?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
jgardezicommented, Jun 14, 2017

I am running Lambda as Kinesis consumer and invoking function in itself.

called_function = context.invoked_function_arn

lambda_client = boto3.client('lambda', region_name='my-region')
        lambda_client.invoke(
            FunctionName=called_function,
            InvocationType='Event',
            Payload=bytes(json.dumps(event_to_send))
        )
5reactions
zkandacommented, Jun 13, 2017

@jgardezi as it turns out, my problem was I was running it on a public subnet, and lambda doesn’t have an elastic ip to use internet gateway. So switching to private subnet with a nat solves my problem. I hope that helps you or have more clue about your problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS Lambda timeout when another (long) Lambda is invoked
If I'd create a Lambda function with say 5 mins function execution timeout, and invoke it using AWS CLI using RequestResponse (synchronous) ...
Read more >
Troubleshoot Lambda function retry and timeout issues when ...
When I invoke my AWS Lambda function using an AWS SDK, the function times out, the API request stops responding, or an API...
Read more >
Lambda Functions in a VPC Timeout When Trying to Invoke ...
When the AWS SDK in a Lambda function inside a VPC tries to invoke another Lambda function, it's trying to send an HTTP...
Read more >
Lambda Task Timed Out After X Seconds - Dashbird
The default timeout of a Lambda function is three seconds. This means, if you don't explicitly configure a timeout, your function invocations ...
Read more >
AWS Lambda Timeout Best Practices - Lumigo
Use short timeout limits for event sources – set timeout to 3-6 seconds for API calls. · Monitor Lambda function timeouts – put...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found