Skip to content
New issue

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

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

Already on GitHub? # to your account

Respond with output headers when using Lambda Proxy Integration #84

Closed
foysavas opened this issue Jan 12, 2017 · 3 comments
Closed

Respond with output headers when using Lambda Proxy Integration #84

foysavas opened this issue Jan 12, 2017 · 3 comments

Comments

@foysavas
Copy link

API Gateway now recognizes statusCode, body, and headers as part of Lambda Function output.

Can we get serverless-webpack to pass along these headers as well?

In server.js:

    if (isLambdaProxyIntegration) {
      if (resp.headers) {
        for (let header in Object.keys(resp.headers)) {
          res.header(header, resp.headers[header]);
        }
      }
      res.status(resp.statusCode || 200).send(resp.body);
    } else {
      res.status(200).send(resp);
    }
@aheissenberger
Copy link

Here is a Link to a Code which does not work with the ´sls web pack serve´:
https://github.com/GorillaStack/serverless-redirect-example

alle headers are removes from the Response. Does work when deployed to AWS!

@abenab
Copy link

abenab commented May 12, 2017

I've been wanting this fix too, however I think the following line of code should be:

for (let header in resp.headers) {
instead of:
for (let header in Object.keys(resp.headers)) {

@HyperBrain
Copy link
Member

serve will be removed in the next v3.0.0 release in favor of serverless-offline (see #152 ). No efforts will be spent on the function anymore. So I'll close this issue.

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

No branches or pull requests

4 participants