0
votes

I have an API Gateway post request to upload a PDF file to S3 bucket through a lambda function. The Content-Type is application/pdf, under it I define the template as {"content":"$input.body"}.

Inside my lambda function, I have:

public APIGatewayProxyResponse FunctionHandler(APIGatewayProxyRequest request, ILambdaContext context)
    {
        Console.WriteLine(request.Body);
        return new APIGatewayProxyResponse
        {
            Body = request.Body,
            StatusCode = 200
        };
    }

However when I test it in Postman by attaching a PDF file in the request body with the Content-Type as application/pdf, the request body accessed within the lambda function is always empty. Why?

1

1 Answers

0
votes

Binary support for API Gateway needs to be explicitly configured.

Hopefully this is what you're looking for: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-payload-encodings-configure-with-console.html