Skip to navigation

Convert a serverless event into a standard Request, route it through the Hono app, and return a normalized ServerlessResponse.

Parameters

app
{ fetch: (req: Request, env?: Record<string, unknown>) => Response | Promise<Response> }Required

A Hono-compatible application with a fetch method.

event
ServerlessEventRequired

The incoming serverless event. Properties include httpMethod, method, headers, body, isBase64Encoded, path, rawPath, queryStringParameters, multiValueQueryStringParameters and pathParameters (API Gateway REST), rawQueryString (API Gateway v2 and function URLs), and requestContext.

With a signing key set, the signature is checked over the URL SignalWire signed: the URL the platform was called on, with its query, and the raw body.

Returns

Promise<ServerlessResponse> — A normalized response with statusCode, headers, and body.

Example

import { ServerlessAdapter } from '@signalwire/sdk';
const adapter = new ServerlessAdapter('lambda');
const response = await adapter.handleRequest(app, lambdaEvent);
console.log(response.statusCode, response.body);