serverless-golang icon indicating copy to clipboard operation
serverless-golang copied to clipboard

Use proper AWS API Gateway error handling

Open mrserverless opened this issue 8 years ago • 0 comments

As per documentation:

https://aws.amazon.com/blogs/compute/error-handling-patterns-in-amazon-api-gateway-and-aws-lambda/

Errors should return with either prefixes:

[BadRequest] | 400
[Forbidden] | 403
[NotFound] | 404
[InternalServerError] | 500

Or as the following payload:

{
    "errorType" : "InternalServerError",
    "httpStatus" : 500,
    "requestId" : "<context.awsRequestId>",
    "message" : "An unknown error has occurred. Please try again."
}

mrserverless avatar Sep 18 '17 12:09 mrserverless