CodeGenieApp / serverless-express

Run Express and other Node.js frameworks on AWS Serverless technologies such as Lambda, API Gateway, Lambda@Edge, and more.
https://codegenie.codes
Apache License 2.0
5.17k stars 671 forks source link

[Bug] Request headers from APIGWv2 Event can not be stringified #387

Closed hffmnn closed 3 years ago

hffmnn commented 3 years ago

Having code like this:

const headers = JSON.stringify(req.headers);

gives an empty array, even if the incoming event had headers set correctly.

I think I found the underlying problem and opened a PR for that, see https://github.com/vendia/serverless-express/pull/386

robax commented 3 years ago

+1 hit this same issue and can confirm @hffmnn 's fix works. Would love to see this get merged.

dklmuc commented 3 years ago

Can also confirm that the fix works.

And it is correct for v2 payload: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html

brettstack commented 3 years ago

Merged. Sorry for the delay. And thanks again @hffmnn