1 Risposta
- Più recenti
- Maggior numero di voti
- Maggior numero di commenti
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; }
}
}
con risposta un anno fa
Contenuto pertinente
- AWS UFFICIALEAggiornata 2 anni fa
- AWS UFFICIALEAggiornata 2 mesi fa
- AWS UFFICIALEAggiornata 2 anni fa
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.