I am trying to make a local Java program run in AWS Lambda and make it such that it can be called with a HTTP request. All I need is just to be able to duplicate the functionality of running java locally from the command line through HTTP in AWS so other people in the company can run the code by just sending a HTTP request in Postman(for now, next step is a web form that just makes the request) instead of downloading the jar and launching the Java command line.
I went through the hello world tutorial in the Amazon website and was able to adapt my code, and run it successfully using the test function in the AWS Lambda control panel. I am also able to see the logs in cloudwatch that it ran and also observe the results. So it all works from the Lambda control panel test function.
So instead of command line arguments, I'm giving the arguments in JSON format as follows:
{
"environment": "dev",
"username": "Test",
"password": "Test22",
"storeId": "TESTMA0001",
"data": "a,b,c,d"
}
And this works quite well when invoking the lambda from the test function.
However I want to be able to enter this in the body of a HTTP request and have my lambda run so I added an api gateway through the gui in the aws lambda panel, chose HTTP API kind and default options.
Then I send a HTTP GET request to the api endpoint with the body being the same input I used in the testing panel, but whenever I run it, I get internal server error. I turned on access logs for the gateway api, and I get the following, my lambda is not being launched by the api since there is no lambda log being written when I use the API, it gets written when I launch it from the AWS lambda web panel.
{
"requestId": "KByVuheeoAMEPLA=",
"ip": "",
"requestTime": "27/Mar/2020:02:25:40 +0000",
"httpMethod": "GET",
"routeKey": "$default",
"status": "500",
"protocol": "HTTP/1.1",
"responseLength": "35"
}
My handleRequest function takes a string, string map as input and returns a string as output:
public class StoreCategoryImporter implements RequestHandler<Map<String,String>, String> {
@Override
public String handleRequest(Map<String,String> event, Context context)
I don't even use the context object but it was there in the tutorial so it remained.
I googled for hours and I have not been able to find a solution, any help would be appreciated. I find most AWS tutorials to skip over some crucial details or they don't have it for POJO developers and use js which I don't understand.
Thank you in advance.

eventhas different format. Your payload will be inevent['body'].