user1765862
user1765862

Reputation: 14195

when invoked aws lambda function always return same response

I use Visual Studio AWS extensions in order to create simple aws lambda function using docker image template. Docker image has been built, tagged and finally pushed to the container registry. From there I create a new lambda function using container image. But when I test it (either locally using dotnet lambda invoke-function or using Test tool on AWS console I'm getting

Amazon Lambda Tools for .NET Core applications (5.3.0) Project Home: https://github.com/aws/aws-extensions-for-dotnet-cli, https://github.com/aws/aws-lambda-dotnet

Payload: {"Lower":"test","Upper":"TEST"}

Log Tail: START RequestId: 67ac52b9-8cd0-449b-9bc3-8584f31f9726 Version: $LATEST END RequestId: 67ac52b9-8cd0-449b-9bc3-8584f31f9726 REPORT RequestId: 67ac52b9-8cd0-449b-9bc3-8584f31f9726 Duration: 890.55 ms Billed Duration: 1224 ms Memory Size: 128 MB Max Memory Used: 61 MB Init Duration: 332.49 ms

This would be ok but I changed the internal implementation of returning my custom string instead of default one. It should return "my custom string test" instead of {"Lower":"test","Upper":"TEST"}

public async Task<string> FunctionHandler(string input, ILambdaContext context)
{
  return "my custom string " + input;
}

Again, why the function returns default response over and over again.

Upvotes: 0

Views: 538

Answers (1)

Wjun
Wjun

Reputation: 133

Check whether your lambda points to the newly deployed image in AWS Console.

Depending on your deployment method, there is potential that your lambda was pointing to the first deployed image all the time. Your situation looks like you are using the old image all the time.

PS: both dotnet lambda invoke-function and using Test tool on AWS console are calling the deployed lambda, so it sounds reasonable that they give you the same result.

Upvotes: 0

Related Questions