Hi @amitm02 ,
You’ll need to configure binary media types (e.g. image/png, image/gif, etc.) AND you need to pass a corresponding Content-Type header.
Setting up binary media types cannot be configured natively in serverless, yet, but there’s a plugin for this.
The following links might help:
- Apig + lambda-proxy + multipart-formdata
- https://github.com/serverless/serverless/issues/2797
- Returning binary data (jpg) from Lambda via API Gateway
Once you setup binary media types and POST an image with a “matching” Content-Type header, the binary data will be base64 encoded. This means the body will be base64 encoded and the property “isBase64Encoded” will be set to true.
Note: Binary media types are applied to requests and responses and require appropriate Content-Type and Accept headers.
Also keep in mind that there’s a limit of 10MB. So using S3 instead might be beneficial in some situations.