Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions .github/workflows/test-on-push-and-pr.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
name: test-on-push-and-pr
name: CI

on:
push:
branches: [ nodejs22.x ]
branches: [nodejs24.x]
pull_request:
branches: [ '*' ]
branches: [nodejs24.x]

jobs:
unit-test:
build-and-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [18, 20, 22]

steps:
- uses: actions/checkout@v5
- name: Build and run tests for Node.js ${{ matrix.node-version }}
run: |
docker build -f test/unit/Dockerfile.nodejs${{ matrix.node-version }}.x -t unit/nodejs.${{ matrix.node-version }}x .
docker run unit/nodejs.${{ matrix.node-version }}x
- uses: actions/checkout@v5

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm

- name: Install dependencies
run: npm ci --ignore-scripts

- name: Build and test
run: npm run build


106 changes: 90 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,63 @@ docker run -p 9000:8080 my-lambda-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:

```dockerfile
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:

```bash
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)
- Make

### Local Development

Expand All @@ -85,44 +134,56 @@ cd aws-lambda-nodejs-runtime-interface-client
# Install dependencies
npm install

# Run tests
# 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
```

### Build Modes
# Clean build artifacts
npm run clean
```

The project supports multiple build modes:
### Build Commands

#### Metal Build (Local Development)
#### Local Build

Fast build for local development and quick iterations:
Build TypeScript and package for distribution:

```bash
npm run build:metal
npm run build
```

- TypeScript compilation only
- No native module compilation
- ~5 seconds build time
This runs tests, compiles TypeScript, and packages the output.

Individual steps:
```bash
npm run compile # TypeScript compilation only
npm run pkg # Package with esbuild
```

#### Container Build (Full Build)

Complete build including native module compilation:
Complete build including native module compilation for Linux:

```bash
npm run build:container
```

- Builds using Docker on AL2023 base image
- Compiles native C++ dependencies
- Produces deployable artifacts
- ~2-3 minutes build time
- 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

Expand All @@ -139,6 +200,19 @@ npm run peek:rie
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"message":"test"}'
```

For multi-concurrent testing:
```bash
npm run peek:rie:mc
```

### Interactive Container Testing

To explore the built package in an interactive container:

```bash
npm run peek:container
```

### Testing in Lambda using Container Image

To deploy and test as a Lambda container function:
Expand All @@ -149,7 +223,7 @@ npm run build:container

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

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

Expand Down
4 changes: 4 additions & 0 deletions RELEASE.CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### Dec 4, 2025
`4.0.0`
- Initial release of `v4` AWS Lambda Runtime Interface Client for NodeJS with typescript and multiconcurrency support for Node.js 24 and Lambda Managed Instances.

### May 21, 2025
`3.3.0`
- Add support for multi tenancy ([#128](https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/pull/128))
Expand Down