uploading image from lambda to s3 ( corrupted file ) uploading image from lambda to s3 ( corrupted file ) express express

uploading image from lambda to s3 ( corrupted file )


In my case, it was API Gateway fault, it turns out you have to enable binary support, otherwise, the lambda function will never receive the binary content:

  1. Go to settings of you ApiGateway endpoint
  2. Go to Binary Media Types
  3. Add new binary type and put: image/jpg

Also if your Lambda function is behind a VPC and a security group, first check if it works without VPC first.