serverless-express icon indicating copy to clipboard operation
serverless-express copied to clipboard

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

Open hffmnn opened this issue 5 years ago • 3 comments

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

hffmnn avatar Mar 12 '21 08:03 hffmnn

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

robax avatar Apr 03 '21 03:04 robax

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

dklmuc avatar May 28 '21 08:05 dklmuc

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

brettstack avatar May 31 '21 06:05 brettstack