admin管理员组

文章数量:1287786

I have a C# application on .NET 6 running at AWS ECS Fargate. It calls AWS lambda function using AWS SDK. The C# code works well when the lambda runs less than 5 minutes, but gets the following exception when lambda runs more than 5 minutes.

Amazon.Lambda.AmazonLambdaException: Signature expired: 20250222T214100Z is now earlier than 20250222T215101Z
(20250222T215601Z - 5 min.).

It's the case when invoked lambda at 21:41:00, took 10 minutes (ended at 21:51:01), exception thrown after 15 minutes (21:56:01)

Found that the signature is sent at request using current timestamp and throws error if it is more than 5 minutes regardless of 15 minutes' timeout from lambda side.

If lambda runs 7 minutes, the lambda ran successfully but C# does not get respond and throws the exception after 15 minutes.

AWS Lambda is correctly setup to have 15 minutes timeout. AWS-SDK-NET are up to date.

var lambdaClient = new AmazonLambdaClient(new AmazonLambdaConfig
{
    Timeout = TimeSpan.FromMinutes(15)
});

var request = new InvokeRequest
{
    FunctionName = LAMBDA_FUNCTION_NAME,
    InvocationType = InvocationType.RequestResponse,
    Payload = PAYLOAD
};

var response = await lambdaClient.InvokeAsync(request);

There is an article with same issue

But using 'ResignRetries = true' makes the lambda run multiple times.

Is there anyway to increase signature timeout to more than 5 minutes?

本文标签: net coreSignature expired exception when AWS lambda runs more than 5 minutes from CStack Overflow