I'm trying to return status error codes (ex. 500, 400, 401) through my AWS Gateway and can't seem to figure it out.
I've seen a few examples, where they do something like:
return context.fail('Bad Request: You submitted invalid input');
However, there is no fail or succeed methods on the ILambdaContext
object.
Here's what I've got so far (non-working)
Lambda Code:
var addressresponse = new AddressValidationResponse();
addressresponse.Errors = new string[1];
addressresponse.Errors[0] = "test error";
addressresponse.Reason = "client_error";
return addressresponse;
I think I'm close, but I'm still getting a 200 back with the response of:
{
"Reason": "client_error",
"Errors": [
"test error"
]
}
What am I missing here?