
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
aws-lambda-response
Advanced tools
A simple package for building standard responses in AWS Lambda callback functions.
A simple package for building standard responses in AWS Lambda callback functions to be handled by API Gateway.
$ npm install --save aws-lambda-response
API Gateway does not support objects as the error parameter in callbacks from Lambda, this package solves this by stringifying error and failure responses and assumes the JSON is parsed at API Gateway level.
import resp from 'aws-lambda-response';
function handler(event, context, callback) {
callback(null, resp.success(200, { hello: "World"}));
}
export { handler };
The following API is based on the imported module being named resp
, however it can be substituted for any name you want.
// ES6 modules
import resp from 'aws-lambda-response';
// commonJS modules
const resp = require('aws-lambda-response');
resp.success(statusCode, data)
Type: int
HTTP status code to be mapped in the API Response header
Type: object
Response payload.
Type: object
{
status: "success",
httpStatus: (int)statusCode,
data: (obj)data
}
resp.error(statusCode, message, data)
Type: int
HTTP status code to be mapped in the API Response header
Type: string
Error message
Type: object
Any additional response data.
Type: string
Stringified object to be parsed in API Gateway output mapping.
{
"status": "error",
"httpStatus": "(int)statusCode",
"message": "(string)message",
"data": "(object)data"
}
resp.fail(statusCode, data)
Type: int
HTTP status code to be mapped in the API Response header
Type: object
Response data that may help explain the issue. Can be be a string if the information is better presented as one.
Type: string
Stringified object to be parsed in API Gateway output mapping.
{
"status": "fail",
"httpStatus": "(int)statusCode",
"data": "(object)data"
}
MIT
FAQs
A simple package for building standard responses in AWS Lambda callback functions.
The npm package aws-lambda-response receives a total of 9 weekly downloads. As such, aws-lambda-response popularity was classified as not popular.
We found that aws-lambda-response demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.