Problems returning an gzip from an endpoint. CONVERT_TO_BINARY not working properly

I have seen that everybody has trouble with this issue, but my problem is kinda different from everything else posted here. I am trying to have my endpoint return a gzip file from S3, but I am encountering some difficulties. At first we tried simply adding contentHandling: CONVERT_TO_BINARY to our serverless.yaml, but that just gave us a corrupt zip file. Then we tried using serverless-apigwy-binary plugin. At first this seemed to work, the endpoint worked and we were downloading a correct zip. The problem camew when we tested the other endpoints after this change. All the other endpoints stopped working. Apparently, ApiGateway was treating all the responses of our api as binary64 encoded files. Has anyone faced this problem before? Is there a way to work around it? If not, how do people usually download zips? We are trying to avoid S3 presigned urls, but we are open to other solutions.

1 Like