npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

invoke-lambda

v2.0.0

Published

Lambda Invoke Layer

Readme

Request for AWS Lambda Functions

Use this package as Lambda Layer to get a standard input for the API Request.

Install

npm i request-lambda --save

the API

/**
* 
* @param fnName. The function name | the function ARN
* @param payload. The JSON that you want to provide to your Lambda function as input.
* @param args. The function region (string), and/or the options (object)
* @returns {Promise<any>}
*/

async invoke (fnName, payload, ...args) {}

/**
* 
* @param fnName. The function name | the function ARN
* @param payload. The JSON that you want to provide to your Lambda function as input.
* @param args. The function region (string), and/or the options (object)
* @returns {Promise<any>}
*/
async invokeEvent (fnName, payload, ...args) {}

Note. When uou use the invokeEvent API, the option key "InvocationType" has "Event" as value. You cannot override it by the options object.

Usage

const { invoke, invokeEvent } = require('invoke-lambda')

const myPayload = {
              key1: 'value1',
              key2: {},
              key3: true
}

// Invoke lambda by the ARN 
try {
    const response = await invoke('arn:aws:lambda:us-east-1:XXXXXXX:function:my-function-name', myPayload)
    console.log(response)
} catch (e) {
    console.log('Error:', e.message)
}

// Invoke lambda by the function name (you have to declare the proper region)
try {
    const response = await invoke('my-function-name', myPayload, 'us-east-1')
    console.log(response)
} catch (e) {
    console.log('Error:', e.message)
}

// With options
try {
    const response = await invoke('my-function-name', myPayload, 'us-east-1', {
        InvocationType: 'Event',
        Qualifier: 'prod'
    })
    console.log(response)
} catch (e) {
    console.log('Error:', e.message)
}

Invoke asynchronously

// Invoke the lambda function asynchronously (InvocationType: 'Event')
try {
    const response = await invokeEvent('my-function-name', myPayload, 'us-west-1')
    console.log(response)
} catch (e) {
   console.log('Error:', e.message)
}

Options:

InvocationType (string)

Possible values:

  • RequestResponse (default). Invoke the function synchronously. Keep the connection open until the function returns a response or times out. The API response includes the function response and additional data.
  • Event. Invoke the function asynchronously. Send events that fail multiple times to the function's dead-letter queue (if it's configured). The API response only includes a status code.
  • DryRun. Validate parameter values and verify that the user or role has permission to invoke the function.

Qualifier (string)

Specify a version or alias to invoke a published version of the function.

ReturnParsedPayload (boolean)

If false, the invoke function will return the entire AWS lambda invoke response. Otherwise, the function will return the parsed "Payload" lambda response. This option works only for RequestResponse