A utility for formatting AWS Lambda error responses into a consistent JSON structure with HTTP status codes, CORS headers, and serialized error messages. Version 0.5.0 is the latest stable release. It provides a simple API with helper methods for common HTTP errors (bad request, unauthorized, forbidden, not found, conflict, internal server error). Compared to alternatives like @middy/http-error-handler, this package is lighter and focuses on formatting errors rather than handling Lambda lifecycle. It is ESM-only? No, it uses CommonJS require. No recent updates; appears to be in maintenance mode.
npm install lambda-errors-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to import the package and format errors with default status, custom status code, and named helper function.
Parse the body if you need an object: JSON.parse(response.body)
Use formatCode(statusCode, message) or named helpers for explicit codes.
Modify the headers in the response before returning, or use a custom response formatter.
Use CommonJS require: const errorFormatter = require('lambda-errors-formatter');Run: npm install lambda-errors-formatter --save
No dependency data recorded yet.