aws-powertools/powertools-lambda-typescript

Bug: REST API Event Handler Rejects Valid APIGatewayProxyEvent

Closed this issue · 2 comments

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

Warning

This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

This is now released under v2.26.0 version!