aws

http://status.aws.amazon.com/ https://www.expeditedssl.com/aws-in-plain-english
cfleming 2021-05-03T10:05:55.048900Z

Has anyone successfully used a lambda proxy integration to return binary data? I cannot for the life of me get AWS to convert the base64 encoded response to binary. I’m returning content-type: application/zip (checked with curl), I have binaryMediaTypes: ["application/zip"] set on my REST API with CDK and I’ve checked in the console that it’s there, and I’m passing curl -i -H "Accept: application/zip" <url>, and I’m still getting base64 encoded text back. Any further ideas?

1😕1
dabrazhe 2021-05-10T11:42:25.049900Z

The gut feeling is there’s something off with the API Gateway settings ( i am not familiar with it enough to be sure). You could try invoking the Lambda function directly, via its url, and reproduce the issue.

cfleming 2021-05-11T03:29:23.050200Z

Yes, it must be a problem with the API gateway, since the lambda is behaving correctly. When using the lambda proxy integration, the lambda has to return base64 (which it is) but for some reason I’m missing the magic incantation to make API gateway convert that result to binary data.

dabrazhe 2021-05-11T12:10:21.050400Z

If you have the option of AWS tech support you can ask them the question, or ask a friend who has access to the AWS support : )

cfleming 2021-05-03T10:15:51.049Z

Oh, and I also have contentHandling: apigateway.ContentHandling.CONVERT_TO_BINARY