# Lambda is returning headers in body of request

**URL:** <https://forum.serverless.com/t/lambda-is-returning-headers-in-body-of-request/11321>\
**Category:** Serverless Framework\
**Tags:** lambda\
**Created:** [May 2, 2020, 9:59am UTC](https://forum.serverless.com/t/lambda-is-returning-headers-in-body-of-request/11321 "2020-05-02T09:59:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![svarughese91](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/svarughese91/32/4562_2.png) [@svarughese91](https://forum.serverless.com/u/svarughese91)\
**Post date:** [May 2, 2020, 9:59am UTC](https://forum.serverless.com/t/lambda-is-returning-headers-in-body-of-request/11321/1 "2020-05-02T09:59:50Z")

</div>

I am using serverless to deploy my express js application in lambda. The weird thing is that some apis are returning headers in the body of the response I am not sure why this is happening. Here is my serverless YAML file:

```
org: test
app: test-api
# serverless.yml
service: test-api

package:
  exclude:
   #- node_modules/**
   - __tests__ /**

provider:
    name: aws
    runtime: nodejs10.x
    region: us-east-1
    environment:
        SERVICE_NAME: ${self:service}

plugins:
  - serverless-domain-manager

custom:
  stage: ${opt:stage, dev}
  domains:
    prod: api.test.com
    dev: dev-api.test.com

  customDomain:
    basePath: "${self:provider.environment.SERVICE_NAME}"
    domainName: ${self:custom.domains.${self:custom.stage}}
    stage: "${self:custom.stage}"
    createRoute53Record: true

functions:
  test-api:
    handler: build/app.handler
    environment:
        stage: ${self:custom.stage}
    events:
      - http:
          path: v1/s
          method: GET
          cors: true
      - http:
          path: v1/sc
          method: GET
          cors: true
      - http:
          path: v1/s/{s}
          method: GET
          cors: true
      - http:
          path: v1/cs
          method: POST
          cors: true
      - http:
          path: v1/s
          method: POST
          cors: true
      - http:
          path: v1/s/{s}
          method: DELETE
          cors: true
      - http:
          path: v1/s/{s}
          method: PUT
          cors: true

```

Here is what the response looks like:

curl -d ‘{“c”:“test”}’ -H “Content-Type: application/json” -X POST [https://dev-api.test.com/test-api/v1/cs](https://dev-api.test.com/test-api/v1/cs)

```
HTTP/1.1 200 Not Modified
X-Powered-By: Express
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: sessionId
Vary: Origin
Content-Type: application/json; charset=utf-8
Content-Length: 55
ETag: W/"37-vmzwGqI9Wb8ACGS7qhhE3/JBqt4"
Date: Fri, 24 Apr 2020 12:30:41 GMT
Connection: keep-alive

{"rsp":{"msg":{"s":[],"c":{}},"err":null}

```

Any idea if its the serverless yaml or some other configuration?

---

<div class="post-metadata">

**Author:** ![garethmcc](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/garethmcc/32/2276_2.png) [@garethmcc](https://forum.serverless.com/u/garethmcc)\
**Post date:** [May 2, 2020, 10:01am UTC](https://forum.serverless.com/t/lambda-is-returning-headers-in-body-of-request/11321/2 "2020-05-02T10:01:13Z")

</div>

There was a bug related to this has since been fixed. Just `npm i -g serverless` to update and re-deploy
