# handle

**Kind:** Function

**Source:** [`src/adapter/aws-lambda/handler.ts`](https://github.com/honojs/hono/blob/main/src/adapter/aws-lambda/handler.ts#L239)

**Part of:** [Adapter](subsystem-src-adapter)

Converts a Hono application to an AWS Lambda handler.

Accepts events from API Gateway (v1 and v2), Application Load Balancer (ALB),
and Lambda Function URLs.

`handle` converts a Hono application into an AWS Lambda handler. It adapts requests from API Gateway v1 and v2, Application Load Balancers, and Lambda Function URLs into Hono requests, then returns the Hono response in the Lambda-compatible format.

## Signature

```ts
function handle(app: Hono<E, S, BasePath>, { isContentTypeBinary }: HandleOptions): (<L extends LambdaEvent>( event: L, lambdaContext?: LambdaContext ) => Promise< APIGatewayProxyResult & (L extends { multiValueHeaders: Record<string, string[]> } ? WithMultiValueHeaders : WithHeaders) >)
```

## Parameters

| Name | Type |
|---|---|
| `app` | `Hono<E, S, BasePath>` |
| `{ isContentTypeBinary }` | `HandleOptions` |

**Returns:** `(<L extends LambdaEvent>( event: L, lambdaContext?: LambdaContext ) => Promise< APIGatewayProxyResult & (L extends { multiValueHeaders: Record<string, string[]> } ? WithMultiValueHeaders : WithHeaders) >)`

## Diagram

```mermaid
graph LR
  Event[API Gateway / ALB / Lambda Function URL] --> Handler[handle]
  Handler --> Hono[Hono application]
  Hono --> Response[Lambda response]
```

## Usage

```ts
import { Hono } from 'hono'
import { handle } from 'hono/aws-lambda'

const app = new Hono()

app.get('/', (c) => {
  return c.text('Hello from Hono')
})

export const handler = handle(app)
```

## AI Coding Instructions

- Pass the configured Hono application directly to `handle` when exporting the Lambda handler.
- Keep route definitions and middleware on the Hono application before creating the Lambda handler.
- Use this adapter for API Gateway v1, API Gateway v2, ALB, and Lambda Function URL events.
- Do not write separate event parsing logic for supported AWS event sources unless application-specific behavior requires it.
