@keboola/serverless-default-error-responses

Serverless plugin that adds unified API Gateway responses for error states

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@keboola/serverless-default-error-responses
312.1.1a year ago5 years agoMinified + gzip package size for @keboola/serverless-default-error-responses in KB

Readme

serverless-default-error-responses

serverless
Serverless plugin that adds unified API Gateway responses for error states. It adds CORS headers to all 4xx and 5xx API responses and formats output for users like this:
{
  "errorMessage": "Application Error", 
  "errorCode": 500, 
  "apiRequestId": "2e2819fa-c93c-11e7-a46f-91ce8f8df51e"
}
It hides real error reason in case of 5xx errors and replaces it for Application Error. It also adds API Gateway request id for potential further investigation in CloudWatch logs.

Installation

  1. Install npm package: yarn add @keboola/serverless-default-error-responses --dev
  2. Add plugin to your serverless.yml:
plugins:
- '@keboola/serverless-default-error-responses'