Amazon Web Services · api · fg-0175

event.httpMethod and event.path are undefined in a Lambda behind an API Gateway HTTP API

event.httpMethod is undefined

Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100

Cause

HTTP APIs created in the console use payload format 2.0, which moves the method and path to requestContext.http and rawPath. Format 2.0 also merges duplicate headers and query strings with commas.

Fix

Read the 2.0 fields, or set the integration payloadFormatVersion to 1.0 if the handler expects the REST API shape. The CLI, CloudFormation and SDKs require you to choose it explicitly.

Apply

const method = event.requestContext?.http?.method ?? event.httpMethod;
const path = event.rawPath ?? event.path;

# or keep the old shape
aws apigatewayv2 update-integration --api-id $API --integration-id $INT --payload-format-version 1.0

Affects: API Gateway HTTP APIs (apigatewayv2) with payload format version 2.0, the console default

Sources

Have your agent know this before it fails

claude mcp add --transport http footgun https://getfootgun.com/api/mcp