Skip to content

Bug: REST API Event Handler Rejects Valid APIGatewayProxyEvent #4454

@svozza

Description

@svozza

Expected Behavior

The isAPIGatewayProxyEvent function should handle events where fields such as headers or multiValueHeaders are null.

Current Behavior

Currently we throw an exception when events of sort described above, which are valid, are recieved.

Code snippet

This valid event fails

const valid event = {
  "resource": "/{proxy+}",
  "path": "/test",
  "httpMethod": "GET",
  "headers": null,
  "multiValueHeaders": null,
  "queryStringParameters": null,
  "multiValueQueryStringParameters": null,
  "pathParameters": {
    "proxy": "test"
  },
  "stageVariables": null,
  "requestContext": {
    "resourceId": "ovdb9g",
    "resourcePath": "/{proxy+}",
    "httpMethod": "GET",
    "extendedRequestId": "QpFAfF5hDoEFjTw=",
    "requestTime": "09/Sep/2025:15:59:11 +0000",
    "path": "/{proxy+}",
    "accountId": "account-id",
    "protocol": "HTTP/1.1",
    "stage": "test-invoke-stage",
    "domainPrefix": "testPrefix",
    "requestTimeEpoch": 1757433551599,
    "requestId": "eecdfcfa-225a-4ee3-bdca-05fc31b6018a",
    "identity": {
    // ...
    },
    "domainName": "testPrefix.testDomainName",
    "apiId": "einxngk45i"
  },
  "body": null,
  "isBase64Encoded": false
} 

Steps to Reproduce

  1. Supply an event as described above to the isAPIGatewayProxyEvent function

Possible Solution

No response

Powertools for AWS Lambda (TypeScript) version

latest

AWS Lambda function runtime

22.x

Packaging format used

npm

Execution logs

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcompletedThis item is complete and has been merged/shippedevent-handlerThis item relates to the Event Handler Utility

Type

No type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions