1 Respuesta
- Más nuevo
- Más votos
- Más comentarios
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; }
}
}
respondido hace un año
Contenido relevante
- OFICIAL DE AWSActualizada hace 2 años
- OFICIAL DE AWSActualizada hace 3 años
- OFICIAL DE AWSActualizada hace un año
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.