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

aws-lambda-ric

v4.0.2

Published

AWS Lambda Runtime Interface Client for Node.js

Readme

AWS Lambda Node.js Runtime Interface Client (RIC)

CI npm version License

This package implements the AWS Lambda Runtime Interface Client (RIC) for Node.js. It allows you to run Lambda functions in custom container images or local testing environments.

The RIC enables communication between your Lambda function code and the Lambda Runtime API, handling the invoke lifecycle including initialization, invocation, and error reporting.

Supported Node.js Versions

  • Node.js 22.x and above

Installation

npm install aws-lambda-ric

Usage

Basic Usage

Create a handler file (e.g., index.js):

exports.handler = async (event, context) => {
  console.log('Event:', JSON.stringify(event, null, 2));
  return {
    statusCode: 200,
    body: JSON.stringify({ message: 'Hello from Lambda!' })
  };
};

Using with Container Images

When building custom Lambda container images, use the RIC as the entrypoint:

FROM public.ecr.aws/lambda/nodejs:22

# Copy function code
COPY index.js ${LAMBDA_TASK_ROOT}

# Install dependencies
COPY package*.json ${LAMBDA_TASK_ROOT}/
RUN npm install

CMD ["index.handler"]

Using with AWS Lambda Runtime Interface Emulator (RIE)

For local testing, you can use the RIC with the AWS Lambda Runtime Interface Emulator:

# Build your container
docker build -t my-lambda-function .

# Run with RIE
docker run -p 9000:8080 my-lambda-function

# Invoke the function
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"message":"test"}'

Building on Custom Linux Distributions

You can build and run Lambda functions with the RIC on your own platform. Here's a minimal Dockerfile example:

FROM quay.io/centos/centos:stream9 AS build-image

ARG NODE_VERSION=22.14.0
ARG FUNCTION_DIR="/function"

# Install build dependencies
RUN dnf -y install \
    autoconf \
    automake \
    cmake \
    gcc \
    gcc-c++ \
    libtool \
    make \
    python3 \
    xz \
    && dnf clean all

# Install Node.js
RUN ARCH=$(uname -m) && \
    if [ "$ARCH" = "x86_64" ]; then NODE_ARCH="x64"; else NODE_ARCH="arm64"; fi && \
    curl -fsSL https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.xz | \
    tar -xJ -C /usr/local --strip-components=1

# Create function directory
RUN mkdir -p ${FUNCTION_DIR}
WORKDIR ${FUNCTION_DIR}

RUN npm install aws-lambda-ric

ENTRYPOINT ["npx", "aws-lambda-ric"]
CMD ["index.handler"]

Build and run locally with RIE:

docker build -t my-lambda .
docker run -p 9000:8080 \
  -e AWS_LAMBDA_FUNCTION_NAME=test \
  -v ~/.aws-lambda-rie:/aws-lambda \
  --entrypoint /aws-lambda/aws-lambda-rie \
  my-lambda npx aws-lambda-ric index.handler

Building from Source

Prerequisites

  • Node.js 22.x or later
  • npm
  • Docker (for container builds)

Local Development

# Clone the repository
git clone https://github.com/aws/aws-lambda-nodejs-runtime-interface-client.git
cd aws-lambda-nodejs-runtime-interface-client

# Install dependencies
npm install

# Run all tests with coverage and linting
npm test

# Run unit tests only
npm run test:unit

# Run integration tests only
npm run test:integ

# Run linter
npm run lint

# Fix linting issues
npm run lint:fix

# Clean build artifacts
npm run clean

Build Commands

Local Build

Build TypeScript and package for distribution:

npm run build

This runs tests, compiles TypeScript, and packages the output.

Individual steps:

npm run compile    # TypeScript compilation only
npm run pkg        # Package with esbuild

Container Build (Full Build)

Complete build including native module compilation for Linux:

npm run build:container
  • Builds using Docker on AL2023 base image
  • Compiles native C++ dependencies (curl, aws-lambda-cpp)
  • Produces deployable artifacts in build-artifacts/
  • Targets linux/amd64 by default for Lambda compatibility
  • Use PLATFORM=linux/arm64 npm run build:container for ARM64 Lambda

Testing with RIE

To test the runtime using the AWS Lambda Runtime Interface Emulator:

# Build the project (one-time)
npm run build:container

# Run with RIE
npm run peek:rie

# In another terminal, invoke the function
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"message":"test"}'

For multi-concurrent testing:

npm run peek:rie:mc

Interactive Container Testing

To explore the built package in an interactive container:

npm run peek:container

Testing in Lambda using Container Image

To deploy and test as a Lambda container function:

# Build the project
npm run build:container

# Review and update variables in scripts/lambda-build.sh

# Build and deploy (requires AWS credentials)
npm run peek:lambda

Architecture

The RIC consists of several components:

  • Runtime Client: Communicates with the Lambda Runtime API
  • Context Builder: Constructs the Lambda context object
  • Function Loader: Loads and resolves user handler functions
  • Logging: Handles structured logging to CloudWatch
  • Streaming: Supports response streaming for applicable invocation modes

Native Module

The RIC includes a native C++ module for high-performance communication with the Lambda Runtime API. This module is built using:

Pre-built archives for these dependencies are included in the deps/ directory.

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Security

See CONTRIBUTING.md for information on reporting security issues.