@keboola/serverless-default-error-responses

2.1.1 • Public • Published

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'

/@keboola/serverless-default-error-responses/

    Package Sidebar

    Install

    npm i @keboola/serverless-default-error-responses

    Weekly Downloads

    0

    Version

    2.1.1

    License

    MIT

    Unpacked Size

    10.6 kB

    Total Files

    7

    Last publish

    Collaborators

    • ujovlado
    • halama
    • najlos
    • keboola-devel
    • jakubkotek