I’m trying to upload a file from a device (deskphone) to S3 via an API Gateway put method, but the file is getting corrupted….
The phone has a utility to save it’s crash log as a tar.gz file locally and also to be uploaded via HTTP PUT or POST to a file server.
I’ve created a PUT method in API Gateway that will save the file to an S3 bucket. This triggers a Lambda (python) function that generates a pre-authenticated link to email to the user to download the tar.gz file.
The problem is AWS is not passing through the file to S3. The tar.gz file in the S3 bucket (and in the pre-authenticated link) is double the size of the orignal, and can’t be extracted (“not an archive” error when I try to extract from it)
Tried setting all the content types to application/gzip in the API Gateway Method Request and Integration Request
I’ve read that I maybe need to add encoding paramters to the mapping template.
Looking at other solutions should I ditch the API Gateway and do it via Lambda only?
PossibleTrait is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.