1 回答
- 最新
- 投票最多
- 评论最多
0
Hello,
I deployed your Lambda and it worked with the testevent you provided using the Lambda-Test-tab in the console:
{ "FirstName": "JTran" }
Result: "Additional text added as a test JTran"
Are you sure that you not accidently saved a faulty testevent and lambda is using that always instead of your input?
Handlername differs in my case (because I used hello-world-sam application as a template): HelloWorld::HelloWorld.Function::FunctionHandler
Using: .NET 6 (C#/PowerShell) & x86_64
using Amazon.Lambda.Core;
//using Amazon.Lambda.SQSEvents;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class.
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]
namespace HelloWorld
{
public class Function
{
public string FunctionHandler(ApiHeader input, ILambdaContext context)
{
return $"Additional text added as a test {input.FirstName}";
}
}
}
namespace HelloWorld
{
public class ApiHeader
{
public string ApiID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Body { get; set; }
}
}
已回答 1 年前
相关内容
- AWS 官方已更新 7 个月前
- AWS 官方已更新 3 年前
- AWS 官方已更新 1 年前
Hello! Thank you for responding, I don't believe I saved a faulty testevent. I do have to inquire, the lambda is part of a CDK CloudFormation stack. With the Lambda function being in a separate file, if I were to update the function code itself, can I just save it or do I need to run cdk deploy again?
Hey, you can just change/update the lambda directly. And as long as you don't change the lambdaname, cloudformation itself shouldn't detect a drift so its ok imo.