Testing the Lambda itself works from the Lambda console; I pass in "asdf" and get "ASDF" as a response.
However when I add an API Gateway:
- Go to Lambda console: https://us-west-2.console.aws.amazon.com/lambda/home
- Add trigger
- API Gateway
- HTTP API (REST API has the same issue)
- Open
- CORS enabled
I get a {"message":"Internal Server Error"}
This code works (removing the input
parameter):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Amazon.Lambda.Core;
using Complyify.Contexts;
using Complyify.Engines;
// 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 ComplyifyLambda
{
public class Function
{
public string FunctionHandler(/* string input, */ ILambdaContext context)
{
return "Hello, World";
}
}
}
This code does not work:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Amazon.Lambda.Core;
using Complyify.Contexts;
using Complyify.Engines;
// 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 ComplyifyLambda
{
public class Function
{
public string FunctionHandler(string input, ILambdaContext context)
{
return input?.ToUpper();
}
}
}