lambdaAdapter
lambdaAdapter<
TEventMap>(router,options): (event,context) =>Promise<APIGatewayProxyResult>
Defined in: lambda/src/index.ts:37
Creates an AWS Lambda handler for handling webhooks
The Lambda event body is used directly for signature verification. API Gateway provides the raw body as a string (or base64-encoded string), which is decoded and used for signature verification.
Type Parameters
Section titled “Type Parameters”TEventMap
Section titled “TEventMap”TEventMap extends Record<string, WebhookEvent>
Parameters
Section titled “Parameters”router
Section titled “router”WebhookRouter<TEventMap>
The WebhookRouter instance
options
Section titled “options”LambdaAdapterOptions<TEventMap[keyof TEventMap]>
Adapter options including a verifier function
Returns
Section titled “Returns”Lambda handler function
(
event,context):Promise<APIGatewayProxyResult>
Parameters
Section titled “Parameters”APIGatewayProxyEvent
context
Section titled “context”Context
Returns
Section titled “Returns”Promise<APIGatewayProxyResult>
Example
Section titled “Example”import { lambdaAdapter } from '@kotodayori/lambda';import { createStripeVerifier, StripeWebhookRouter } from '@kotodayori/stripe';
const router = new StripeWebhookRouter();
export const handler = lambdaAdapter(router, { verifier: createStripeVerifier(stripe, process.env.STRIPE_WEBHOOK_SECRET!),});