The problem is disappeared after re-deploy the whole AWS CDK Stack. I will keep the question open and update to it if issue occurs again. Speical thanks to @Chetan for helping and not leaving me alone.
I have a .NET6 Web API hosted as AWS Lambda. It retrieves data from the AWS Secret manager using AmazonSecretsManagerClient from Amazon.SecretsManager package. It was working fine until two days ago. To test the connection again, I tried to simply add and run the following code in my Program.cs
, however, only the first console.writeline message is printed in log. Then the application just hangs there until reaching Lambda's timesout.
Console.WriteLine("Calling secret manager request - started");
var smClient = new AmazonSecretsManagerClient();
var descriptResponse = await smClient.DescribeSecretAsync(new DescribeSecretRequest
{
SecretId = "secretName"
});
Console.WriteLine($"got ARN - {descriptResponse.ARN}");
Console.WriteLine("Calling secret manager request - end");
What I have done so far:
- I tried to put a try-catch around it, but still no exception was thrown.
- I checked the Lambda's IAM role which has the permission - see screenshot 1; I also created a new lambda function with the same role and code, which is working fine that approves the IAM role is correct
- I tried other methods like ListSecretsAsync() etc, and the same result - nothing is returned
- I tried to deploy a working version (main branch and works in UAT) to my dev instance, which has the same prolbem.
It would be very appreciated if anyone can point me in the right direction to debug it further.