AWS Lambda
AWS Lambda source for walkerOS. Works across API Gateway REST (v1), API Gateway HTTP (v2), Lambda Function URLs, and direct invocation. Auto-detects the API Gateway version, supports optional pixel tracking with a 1x1 GIF response, and exposes a built-in health check endpoint. The @walkeros/server-source-aws package also ships sourceSqs for ingesting from SQS queues; this page covers the Lambda handler only.
The AWS Lambda source is a server source in the walkerOS flow:
It receives events via HTTP and forwards them to your destinations.
Installation
npm install @walkeros/server-source-aws- Integrated
- Bundled
import { sourceLambda } from '@walkeros/server-source-aws';
import { startFlow } from '@walkeros/collector';
let handler: any;
async function init() {
if (handler) return handler;
const { sources } = await startFlow({
sources: {
lambda: {
code: sourceLambda,
config: {
settings: { cors: true, healthPath: '/health' },
},
},
},
destinations: {
// Your destinations
},
});
handler = sources.lambda.push;
return handler;
}
export const main = async (event: any, context: any) => {
const h = await init();
return h(event, context);
};
export { main as handler };Add to your flow.json sources:
"sources": {
"lambda": {
"package": "@walkeros/server-source-aws",
"config": {
"settings": {
"cors": true,
"healthPath": "/health"
}
}
}
}Server sources require platform-specific handlers. For containerized deployments, see Docker.
Configuration
This source uses the standard source config wrapper (consent, data, env, id, ...). For the shared fields see source configuration. Package-specific fields live under config.settings and are listed below.
Settings
| Property | Type | Description | More |
|---|---|---|---|
cors | boolean | object | CORS configuration: false = disabled, true = allow all origins, object = custom configuration | |
timeout | integer | Request timeout in milliseconds (max: 900000 for Lambda) | |
enablePixelTracking | boolean | Enable GET requests with 1x1 transparent GIF response for pixel tracking | |
healthPath | string | Health check endpoint path (e.g., /health) |
Mapping
This package does not define custom rule-level settings. For the standard rule fields (consent, condition, data, batch, name, policy) see mapping.
Examples
API Gateway v1 POST
A REST API Gateway v1 POST request with a JSON body is converted into a walker elb event.
{
"httpMethod": "POST",
"path": "/collect",
"requestContext": {
"requestId": "req-789",
"identity": {
"sourceIp": "203.0.113.42"
}
},
"queryStringParameters": null,
"body": "{\"event\":\"page view\",\"data\":{\"title\":\"Home\"}}",
"isBase64Encoded": false
}elb({
"name": "page view",
"data": {
"title": "Home"
}
})Lambda GET
An API Gateway v2 HTTP GET with query parameters is parsed into an elb event payload.
{
"version": "2.0",
"requestContext": {
"http": {
"method": "GET",
"path": "/collect"
},
"requestId": "req-456"
},
"rawQueryString": "e=page+view&d=%7B%22title%22%3A%22Home%22%7D",
"isBase64Encoded": false
}elb({
"e": "page view",
"d": "{\"title\":\"Home\"}"
})Lambda POST
An API Gateway v2 HTTP POST with a JSON body is converted into a walker elb event.
{
"version": "2.0",
"requestContext": {
"http": {
"method": "POST",
"path": "/collect"
},
"requestId": "req-123"
},
"body": "{\"event\":\"page view\",\"data\":{\"title\":\"Home\"}}",
"isBase64Encoded": false
}elb({
"name": "page view",
"data": {
"title": "Home"
}
})Ingest metadata
Extract request metadata from Lambda events and forward it through the pipeline.
config.ingest must use the map operator. Keys are output field names; values are direct field paths on the Lambda event (no prefix). A bare object like { ip: 'requestContext.identity.sourceIp' } is silently inert: without the map operator the source passes the whole event through and no field is extracted.
const { sources } = await startFlow({
sources: {
lambda: {
code: sourceLambda,
config: {
settings: { cors: true },
ingest: {
map: {
ip: { key: 'requestContext.identity.sourceIp' }, // v1
ua: { key: 'requestContext.identity.userAgent' }, // v1
// Or for API Gateway v2:
// ip: { key: 'requestContext.http.sourceIp' },
// ua: { key: 'requestContext.http.userAgent' },
},
},
},
},
},
});Available ingest paths
API Gateway v1 (REST API):
| Path | Description |
|---|---|
requestContext.identity.sourceIp | Client IP address |
requestContext.identity.userAgent | User agent string |
headers.* | HTTP headers |
httpMethod | HTTP method |
API Gateway v2 (HTTP API) / Function URLs:
| Path | Description |
|---|---|
requestContext.http.sourceIp | Client IP address |
requestContext.http.userAgent | User agent string |
requestContext.http.method | HTTP method |
headers.* | HTTP headers |
Supported platforms
| Platform | Status |
|---|---|
| API Gateway REST API (v1) | Supported |
| API Gateway HTTP API (v2) | Supported |
| Lambda Function URLs | Supported |
| Direct Lambda invocation | Supported |