Using the AWS Lambda top-level function project template in Visual Studio 2022 I’ve built a basic lambda:
using Amazon.Lambda.Core;
using Amazon.Lambda.RuntimeSupport;
using Amazon.Lambda.Serialization.SystemTextJson;
var handler = (FramerInput input, ILambdaContext context) =>
new FramerOutput { framed = $"{input.outer}{input.inner}{input.outer}" };
await LambdaBootstrapBuilder.Create(handler, new DefaultLambdaJsonSerializer())
.Build()
.RunAsync();
public class FramerInput
{
public string inner { get; set; }
public string outer { get; set; }
}
public class FramerOutput
{
public string framed { get; set; }
}
It has been uploaded and can be called from the AWS Console and VS AWS Toolkit Extension.
To call it via HTTP I’ve created a Function URL but I’ve found no way to invoke the lambda with it, as it always returns the response {"framed":""}
.
As an example I’ve tried via cURL: curl -X GET "https://xxx.lambda-url.us-east-1.on.aws/" -H "Content-type: application/json" -d '{"inner":"TEST_CURL","outer":"*"}'
As far as I understand the pipeline used to call the lambda via HTTP is different and it’s using the API Gateway.
How to fix this code to make it work via the Function URL too?