New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

lambda-node-starter

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lambda-node-starter

An AWS Lambda function Node.js webpack environment

Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Webpack AWS Lambda Environment

Starter

npx lambda-node-starter your-lambda-function-name

Develop

Start writing your lambda function at: src/index.js

npm run dev

Build the bundle file in development mode.

Debug

npm run watch

webpack can watch files and recompile

Configure test event

/**
 * test.js
*/
const Main = require('./build/index');

const test = async () => {
    const event = {
        "key1": "value1",
        "key2": "value2",
        "key3": "value3"
    }
    await Main.handler(event);
};

test();

Environment

Add .env in the root and add environment if you want.

/**
 * .env
*/
AWS_REGION={YOUR_AWS_REGION}
AWS_ACCESS_KEY_ID={YOUR_AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY={YOUR_AWS_SECRET_ACCESS_KEY}

Test your event

npm run test

Build

npm run build

Will build the bundle js file and .zip file in build folder.

Deploy

Upload .zip file to your lambda function.
if you have aws cli, add the FUNCTION_NAME in your environment. Environment may look like this

/**
 * .env
*/
AWS_REGION={YOUR_AWS_REGION}
AWS_ACCESS_KEY_ID={YOUR_AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY={YOUR_AWS_SECRET_ACCESS_KEY}
FUNCTION_NAME={YOUR_LAMBDA_FUNCTION_NAME}

deploy your function by using aws cli

npm run deploy

Others

Setting the AWS Credentials. Link
Setting the AWS Region. Link

FAQs

Package last updated on 14 May 2021

Did you know?

Socket

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.

Install

Related posts