Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
@keboola/middy-error-logger
Advanced tools
Errors logging middleware for Middy.
The middleware catches thrown exceptions and rejected promises and logs them comprehensibly to the console. All logs are enriched with event and context.
It works with http-errors
module and creates a proper HTTP response for them using the message and the status code.
import createError from 'http-errors';
import middy from 'middy';
import errorLogger from '@keboola/middy-error-logger';
export const handler = middy(() => {
throw new createError.UnprocessableEntity();
});
handler
.use(errorLogger());
This sample code writes such a stringified json to the console:
{
"message": "Unprocessable Entity",
"statusCode": 422,
"stack": [
"UnprocessableEntityError: Unprocessable Entity",
"at Function._callee$ (/var/task/src/lambda.js:6:19)",
"at tryCatch (/var/task/node_modules/regenerator-runtime/runtime.js:62:40)",
"..."
],
"event": {
"resource": "/",
"httpMethod": "GET",
"queryStringParameters": null,
"body": null
},
"context": {
"sourceIp": "214.178.123.91",
"userAgent": "Paw/3.1.7 (Macintosh; OS X/10.14.0) GCDHTTPRequest"
},
"awsRequestId": "ab022f5a-d3ad-11e8-89f6-89a425b4ca0a"
}
And return this message to the request response:
{
"errorMessage": "Unprocessable Entity",
"errorCode": 422,
"requestId": "ab022f5a-d3ad-11e8-89f6-89a425b4ca0a"
}
If the error is not an instance from http-errors
, the error message in the response is replaced with "Internal Error." and the status code is set to 500.
FAQs
Error logger middleware for Middy
The npm package @keboola/middy-error-logger receives a total of 5 weekly downloads. As such, @keboola/middy-error-logger popularity was classified as not popular.
We found that @keboola/middy-error-logger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers 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
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.