Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

headers missing on API Gateway V1 response #437

Open
alfaproject opened this issue Jul 19, 2021 · 1 comment
Open

headers missing on API Gateway V1 response #437

alfaproject opened this issue Jul 19, 2021 · 1 comment

Comments

@alfaproject
Copy link

For some reason, the API Gateway V1 response does not include the headers field. It converts the input headers to multiValueHeaders.

This is a breaking change from aws-serverless-express and something that I am now patching manually with patch-package to get back the previous response object.

We have our own API Gateway-like proxy via a Cloudflare worker and CF (or browser) workers don't support multi value headers in the response, so at the very least it would be nice to have an option to just use headers or pass both of them as is to the proxy.

@alfaproject
Copy link
Author

This is the patch I have applied:

diff --git a/node_modules/@vendia/serverless-express/src/event-sources/aws/api-gateway-v1.js b/node_modules/@vendia/serverless-express/src/event-sources/aws/api-gateway-v1.js
index 1179d8a..6c6e9ac 100644
--- a/node_modules/@vendia/serverless-express/src/event-sources/aws/api-gateway-v1.js
+++ b/node_modules/@vendia/serverless-express/src/event-sources/aws/api-gateway-v1.js
@@ -19,6 +19,7 @@ function getResponseToApiGateway ({
   return {
     statusCode,
     body,
+    headers,
     multiValueHeaders,
     isBase64Encoded
   }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant