I am writing a code to pull the information from tables, create an excel sheet from that data, and send it to emails using AWS Lambda (Java). But I am getting an error in the API gateway response: "message": "Endpoint request timed out." I have checked the logs, and it is taking too much time while creating Excel, so I am getting an API response after 30 seconds and getting the error "Endpoint request timed out."
'''
public ApiGatewayResponse handleRequest(Map<String, Object> input, Context context)
{
Response<Object> response = null;
String msg = "";
try
{
int statusCode = EventCode.REQUEST_SUCCESS.getCode();
msg="Job executed successfully";
this.failedAffidavitService.getFailedAffidavitFirmDetails();
response = ApiGatewayUtil.buildResponse(statusCode, msg,null);
LOG.info("job executed succesfully");
}
catch (Exception e)
{
LOG.error("Exception occurred in FailedAffidavitFirmDetailsHandler >> handleRequest()", e);
response = ApiGatewayUtil.buildResponse(EventCode.SERVICE_ERROR.getCode(), e.getMessage(), null);
}
return ApiGatewayResponse.builder().setStatusCode(EventCode.REQUEST_SUCCESS.getCode()).setObjectBody(response.build();
}
} '''