aws-lambda-cpp icon indicating copy to clipboard operation
aws-lambda-cpp copied to clipboard

Lambda return types through HTTP API Gateway - only json array or json object are working , else error 500

Open fxfire opened this issue 4 years ago • 3 comments

I'd like to return binary data through the HTTP API Gateway (HTTP , NOT REST API!), but the response has to be a json object, always. Is there some workaround to make that happen like it is possible for the REST API ?

#include <aws/lambda-runtime/runtime.h>
using namespace aws::lambda_runtime;
static invocation_response my_handler(invocation_request const& req)
{
     return invocation_response::success("binarygoeshere", "application/zip");
}

int main()
{
    run_handler(my_handler);
    return 0;
}

^this returns error code 500

fxfire avatar Feb 27 '21 21:02 fxfire

@fxfire maybe this ?

https://aws.amazon.com/it/about-aws/whats-new/2016/11/binary-data-now-supported-by-api-gateway/

aculnaig avatar Mar 26 '21 10:03 aculnaig

Hey thanks for the reply. But as I wrote in my initial post, these settings are only possible in the offered REST API, not in the HTTP API.

MINIONBOTS avatar Mar 26 '21 10:03 MINIONBOTS

@fxfire https://aws.amazon.com/it/blogs/compute/handling-binary-data-using-amazon-api-gateway-http-apis/

aculnaig avatar Apr 05 '21 09:04 aculnaig