Express Lambda正在请求体中返回头

Express Lambda正在请求体中返回头,express,curl,aws-lambda,serverless-framework,Express,Curl,Aws Lambda,Serverless Framework,我正在使用serverless在lambda中部署我的express js应用程序。奇怪的是,一些API在响应的主体中返回头,我不知道为什么会发生这种情况。这是我的无服务器YAML文件: org: test app: test-api # serverless.yml service: test-api package: exclude: #- node_modules/** - __tests__/** provider: name: aws runtime

我正在使用serverless在lambda中部署我的express js应用程序。奇怪的是,一些API在响应的主体中返回头,我不知道为什么会发生这种情况。这是我的无服务器YAML文件:

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
下面是响应的样子:

curl-d'{“c”:“test”}'-H”内容类型:application/json“-X POST


知道它是无服务器yaml还是其他配置吗

看起来您启用了
curl
的-i选项?curl有别名吗?

我能够修复这个问题,联系了无服务器支持,他们说有一个bug,现在已经修复了。只需要更新serverless,问题就解决了

对此有什么想法吗?除非您在api网关上的集成响应上做了一些更改,否则此配置应该在主体中使用头进行响应。但我还是不明白你指的是什么标题?至少你们分享的看起来是正常的卷曲反应
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}