🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More
Socket
Book a DemoSign in
Socket

@polarity-dev/lambda-local-runner

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polarity-dev/lambda-local-runner

This project provides a local environment to run and test AWS Lambda functions using Node.js.

latest
npmnpm
Version
0.0.8
Version published
Maintainers
1
Created
Source

Lambda Local Runner

This project provides a local environment to run and test AWS Lambda functions using Node.js.

Usage

npm install -g @polarity-dev/lambda-local-runner
echo '{ "my-function": "/path/to/function.js" }' > lambda.json
lambda-local --config lambda.json

Build from source

TL;DR

npm install
cp lambda-sample.json lambda.json
npm run dev a

Requirements

  • Node.js

Setup Instructions

  • Install Dependencies. Run the following command to install necessary dependencies:

    npm install
    
  • Create Lambda Mapping Settings. Copy the sample Lambda configuration file:

    cp lambda-sample.json lambda.json
    

    Then, fill in the details for the Lambda function you intend to manage.

Running the Server

To start the local Lambda server, execute:

npm run dev

Once the server is running, you can invoke your local Lambda functions by using localhost:6789 as the endpoint. Below is an example of how to call a Lambda function using the AWS SDK for JavaScript:

import { LambdaClient, InvokeCommand } from "@aws-sdk/client-lambda"

const lambdaClient = new LambdaClient({
    region: "eu-west-1",
    endpoint: "http://localhost:6789",
})

lambdaClient.send(
    new InvokeCommand({
        FunctionName: "my-function",
        Payload: JSON.stringify({ hello: "world" })
    })
)
.then(console.log)
.catch(console.log)

Testing

Lambda Functions

A minimal example of a JavaScript Lambda function can be found in tests/my-function/index.js

Invoking Lambda Functions

A minimal example of a JavaScript Lambda invoking can be found in tests/invoke-test.ts. To test run the following command:

npm run test:invoke

FAQs

Package last updated on 31 Mar 2025

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