Search code examples
aws-lambdaaws-api-gatewayserverlessserverless-frameworkaws-serverless

AWS API Gateway with proxy-integration by serverless.yml


I'm wondering how to set API Gateway with proxy-integration by serverless.yml (the "Lambda proxy integration" switch)

the proxy-integration switch

In serverless document, I can't find any description about this setting.

And this is my code:

functions:
  lambda_func:
    image: my_image
    timeout: 300
    environment:
      STAGE: ${self:provider.stage}
    events:
      - http:
          path: lambda_func
          method: post
          async: true

I have tried to add 'integration: lambda' to the events config, but it doesn't work.


Solution

  • finally, I find the answer.

    functions:
      lambda_func:
        image: my_image
        timeout: 300
        environment:
          STAGE: ${self:provider.stage}
        events:
          - http:
              path: lambda_func
              method: post
              async: true
              integration: lambda-proxy # have to add this line