Unable to proxy requests containing files

Hi, I have a gateway up and running (2.8.1) and when I try to send a multipart request with a file of any size, I get the error below (from the error.log file)

2022/06/30 15:30:38 [warn] 506#0: *17 a client request body is buffered to a temporary file /usr/local/kong/client_body_temp/0000000001, client: 100.99.99.199, server: kong, request: "POST /hello HTTP/1.1", host: "api.my-domain.com"
2022/06/30 15:30:38 [error] 506#0: *17 [kong] handler.lua:298 [aws-lambda] statusCode must be a number, client: 100.99.99.199,, server: kong, request: "POST /hello HTTP/1.1", host: "api.my-domain.com"

My services are set as Domain > AWS ELB > Kong 2.8.1 (1 route with a AWS Lambda plugin forwarding to the helloWord lambda)

I know the lambda without the file works perfectly, as I can send the payload directly to the lambda.

Has anyone seen this issue before?

This is my service, I currently set it up as a declarative yaml

service:
- name: hello-world2
  url: https://localhost:8443
  routes:
  - name: hello-world2
    paths:
    - /hello 
    plugins:
    - name: request-size-limiting
      config: 
        allowed_payload_size: 1
        size_unit: megabytes
        require_content_length: true
    - name: aws-lambda
      config:
        aws_key: my_aws_key 
        aws_secret: my_aws_secret
        aws_region: eu-west-1
        function_name: helloWorld 
        forward_request_headers: true
        forward_request_uri: true
        forward_request_body: true
        forward_request_method: true
        is_proxy_integration: true
        awsgateway_compatible: false
        skip_large_bodies: false

I also have changed the following directives on the kong.conf, but no matter what valued are, the files still don’t reach the Lambda

nginx_http_client_body_buffer_size = 6m
client_max_body_size 6m;

If, I change my service, and set the is_proxy_integration to false, this is what the api returns (on postman

{
    "Type": "User",
    "message": "Could not parse request body into json: Could not parse payload into json: Invalid UTF-8 start byte 0x89\n at [Source: (byte[])\"{\"request_uri\":\"/hello\",\"request_method\":\"POST\",\"request_headers\":{\"x-amzn-trace-id\":\"Root=1-62bdc919-676b527d1ad45c6728c74e32\",\"x-forwarded-proto\":\"https\",\"x-company-id\":\"8081545426e23d4156942a5f3d6eed\",\"x-initiator-id\":\"808154d23d4d40258156942a5f3d6eed\",\"content-length\":\"9737\",\"content-type\":\"multipart/form-data; boundary=--------------------------252274055593647298465235\",\"host\":\"api.my-domain.com\",\"postman-token\":\"88f532w45132-8681-4575-a186-d601428c78de\",\"accept\":\"*/*\",\"accept-en\"[truncated 29643 bytes]; line: 1, column: 711]"
}

I found the problem. For some reason, the was-lambda plugin doesn’t work well with files and the Content-Length header.

After removing it via the request-transform plugin, the files are now arriving safe and sound at the Lambdas. This is how the service looks like now

service:
- name: hello-world2
  url: https://localhost:8443
  routes:
  - name: hello-world2
    paths:
    - /hello 
    plugins:
    # Request transformer to avoid the lambda error when a file is sent, caused by the content-length field
    - name: request-transformer
      config: 
        remove:
          headers:
          - content-length
          - Content-Length
    - name: request-size-limiting
      config: 
        allowed_payload_size: 5
        size_unit: megabytes
        require_content_length: true
    - name: aws-lambda
      config:
        aws_key: my_aws_key 
        aws_secret: my_aws_secret
        aws_region: eu-west-1
        function_name: helloWorld 
        forward_request_headers: true
        forward_request_uri: true
        forward_request_body: true
        forward_request_method: true
        is_proxy_integration: true
        awsgateway_compatible: false
        skip_large_bodies: false