
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
sam-stereotype
Advanced tools
NodeJS boilerplate handler, dispatch, and framework for AWS SAM
Extracts the event.Records[0].Sns.Message
to event.packet
const { snsHandler } = require('sam-stereotype');
exports.handler = snsHandler((event, context, callback) => {
if (event.packet) {
callback(null, `Successfully received packet: ${event.packet}`);
}
callback(null, `Failed to receive packet: ${event}`);
});
Still working on the additional trigger handlers, while they exist, they shouldn't be used yet.
Available:
In Progress:
Streamlines the SNS Publish process
const { snsDispatch } = require('sam-stereotype');
exports.handler = (event, context, callback) => {
snsDispatch('my-sns-arn', 'my-message')
.then(()=> {
callback(null, 'Successfully dispatched SNS Message');
})
.catch(e => callback(null, `Failed to dispatch SNS Message: ${e.stack}`));
};
Streamlines the SES Publish process
const { sesDispatch } = require('sam-stereotype');
exports.handler = (event, context, callback) => {
sesDispatch(
'myDestination@test.com',
'myFrom@test.com',
'Subject',
'Message with <b>HTML</b>'
)
.then(()=> {
callback(null, 'Successfully dispatched SES Message');
})
.catch(e => callback(null, `Failed to dispatch SES Message: ${e.stack}`));
};
Available:
The build framework is a suggested Makefile and Webpack config.
Either configuration file can be used independently but the Makefile's compile
requires webpack
to be installed. You can use your own webpack config, read make compile
for more information.
Include the Makefile and variables in your Makefile for the suite of shortcuts.
include ./node_modules/sam-stereotype/Makefile
# S3 Bucket to upload Lambdas - Must exist before running any commands
BUCKET = sam-stereotype
# Key prefix: s3:/sam-stereotype/stereotype-files
BUCKET_PREFIX = stereotype-files
# Cloudformation stack name
STACK = sam-stereotype-stack
make compile
Compile will run webpack and copy a package.json
file located in the ./src/
directory into each ./dist/
directory. When using the bundled webpack.config your lambda's would be compiled into the following directory structure.
./dist
./testLambda
./index.js
./package.json
./anotherLambda
./index.js
./pacakge.json
make validate
Validate will run sam validate
make build
Build will run sam build
. The build command assumes a template.yaml
or template.yml
file is in the project root.
make package
Package will run build
as well as sam package
and output the template file to deployment.yaml
make deploy
Deploy will run sam deploy
with the deployment.yaml
to the defined stack name.
make push
Push will run compile, validate, build, package, and deploy.
make down
Down will delete the cloudformation stack.
Require the webpack.config.js to perform lambda packing.
// webpack.config.js
module.exports = require('sam-stereotype/webpack.config');
The webpack configuration assumes there is a ./src/lambda
directory with single file lambda's. Each lambda is packaged into the ./dist/{fileName}
directory as index.js
.
If you are using make compile
, you need to create a package.json
file in the ./src
directory to be included in each ./dist/{lambda}
directory. package.json
is required in each dist directory for package
to run properly.
Your template.yaml
file can include the dist lambda:
Resources:
TestSNS:
Type: AWS::Serverless::Function
Properties:
Runtime: nodejs8.10
Handler: index.handler
Description: Single SNS event handler test
CodeUri: ./dist/testSns
FunctionName: testSns
Timeout: 15
FAQs
NodeJS boilerplate handler, dispatch, and framework for AWS SAM
We found that sam-stereotype 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.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.