I am trying to invoke a lambda function from an app that runs locally on my computer. This lambda function (a docker image container) usually takes several minutes to execute (5-6 minutes), which is normal and it works perfectly well when I am testing it from the aws console and I get the payload response. However, when I try to invoke it from my local app, I don’t receive any response, despite seeing in cloudwatch logs that the lambda function has been executed perfectly with the status code 200.
I don’t know why my local app can’t get the payload response. It ends up to timeout each time. I set the timeout of my aws lambda to 15 minutes, so i’s mor than enought and anyway It’s not a timeout issue as my function execute perfectly well, it just doesn’t send a response to my local app.
Read timeout on endpoint URL: "https://lambda.eu-west-1.amazonaws.com/xxxxxx/functions/xxxxxxxxxxxx/invocations"
I have another basic lambda function that I’ve created for testing purposes and my local app can get the payload response without problem.
Did I make something wrong ?
def handler(event=None, context=None):
try:
config = botocore.config.Config(read_timeout=900, connect_timeout=900, retries={'max_attempts': 0})
client = boto3.client('lambda', config=config)
print("let's go")
response = client.invoke(
FunctionName='my_lambda_function',
InvocationType='RequestResponse',
Payload='{ "test": "true" }'
)
payload = json.loads(response['Payload'].read())
print(payload)
return {
"statusCode": 200,
"body": json.dumps(
{
"message": "ok",
}
),
}
except Exception as e:
print(e)