
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
lambda-event-mock
Advanced tools
Mocking library for testing AWS Lambda events by creating realistic events that contain dynamic data.
Install via npm.
npm install lambda-event-mock --save-dev
The following example code creates an s3
lambda event for the object
picture1.gif
in the my-bucket-uploaded-pictures
bucket.
const lambdaEventMock = require( 'lambda-event-mock' );
let myMock = lambdaEventMock.s3()
.object( 'picture1.gif' )
.bucket( 'my-bucket-uploaded-pictures' )
.build();
// myMock contains an s3 event object:
/*
{
"Records": [
{
"eventVersion": "2.0",
"eventTime": "2018-11-15T20:46:39.446Z",
"requestParameters": {
"sourceIPAddress": "127.0.0.1"
},
"s3": {
"configurationId": "testConfigRule",
"object": {
"eTag": "0123456789abcdef0123456789abcdef",
"sequencer": "0A1B2C3D4E5F678901",
"key": "picture1.gif",
"size": 1024
},
"bucket": {
"arn": "bucketarn",
"name": "my-bucket-uploaded-pictures",
"ownerIdentity": {
"principalId": "USER"
}
},
"s3SchemaVersion": "1.0"
},
"responseElements": {
"x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH",
"x-amz-request-id": "EXAMPLE123456789"
},
"awsRegion": "us-east-1",
"eventName": "ObjectCreated:Put",
"userIdentity": {
"principalId": "USER"
},
"eventSource": "aws:s3"
}
]
}
*/
Note that lambda-event-mock
fills in the time, date, and other properties of
the event to create a realistic looking event.
For documentation on how to use this module in your project, please see our documentation page.
We'd love to get feedback on how you're using lambda-event-mock and things we
could add to make this tool better. Feel free to contact us at
feedback@vandium.io
FAQs
Mocks AWS Lambda events
The npm package lambda-event-mock receives a total of 20,298 weekly downloads. As such, lambda-event-mock popularity was classified as popular.
We found that lambda-event-mock 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
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.