
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
aws-lambda-helper
Advanced tools
Collection of helper methods for lambda
$ npm install aws-lambda-helper --save
var AwsHelper = require('aws-lambda-helper');
exports.handler = function(event, context) {
...
//Initialise the helper by passing in the context
AwsHelper.init(context);
...
}
var AwsHelper = require('aws-lambda-helper');
exports.handler = function(event, context){
// assume : context.invokedFunctionArn = invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789:function:mylambda:prod'
//Initialise the helper by passing in the context
AwsHelper.init(context);
console.log(AwsHelper.env); //prints: prod
console.log(AwsHelper.region); //prints: eu-west-1
console.log(AwsHelper.account); //prints: 123456789
var params = {
FunctionName: 'MyAmazingLambda',
Payload: { 'hello': 'world' },
Qualifier: ''
};
AwsHelper.Lambda.invoke(params, function (err, data) {
AwsHelper.failOnError(err, event, context);
context.succeed(data);
});
}
This function will intercept the error if exists and then will call 'context.fail'. The purpose of this function is to avoid the need of checking for errors so that in callback you could just focus on the succesfull procedure.
It can be used as follows:
AwsHelper.Lambda.invoke(params, function (err, data) {
AwsHelper.failOnError(err, event, context);
context.succeed(data);
});
var AwsHelper = require('aws-lambda-helper');
exports.handler = function(event, context){
// assume : context.invokedFunctionArn = invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789:function:mylambda:prod'
//Initialise the helper by passing in the context
AwsHelper.init(context, event);
var log = AwsHelper.Logger('example');
log.info(); // Returns a boolean: is the "info" level enabled?
// This is equivalent to `log.isInfoEnabled()` or
// `log.isEnabledFor(INFO)` in log4j.
log.info('hi'); // Log a simple string message (or number).
log.info('hi %s', bob, anotherVar); // Uses `util.format` for msg formatting.
log.info({foo: 'bar'}, 'hi');
// The first field can optionally be a "fields" object, which
// is merged into the log record.
log.info(err); // Special case to log an `Error` instance to the record.
// This adds an "err" field with exception details
// (including the stack) and sets "msg" to the exception
// message.
log.info(err, 'more on this: %s', more);
// ... or you can specify the "msg".
log.info({foo: 'bar', err: err}, 'some msg about this error');
// To pass in an Error *and* other fields, use the `err`
// field name for the Error instance.
}
FAQs
Collection of helper methods for lambda
The npm package aws-lambda-helper receives a total of 40 weekly downloads. As such, aws-lambda-helper popularity was classified as not popular.
We found that aws-lambda-helper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 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.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.