I am trying to configure Lambda and the Gateway APIs that will do s3.getObject () and output the binary image as an answer. In the end, I would like to pull the image out of s3 and resize it on the fly instead of saving them back to s3, however I cannot get even a simple image for output.
My simple lambda looks like this:
'use strict';
const http = require('http');
exports.handler = (event, context, callback) => {
http.get('http://i.stack.imgur.com/PIFN0.jpg', function(res) {
var body = '';
res.on('data', function(chunk) {
body += chunk;
});
res.on('end', function() {
callback(null, body);
});
});
};
I installed binary support for the API gateway to allow 'image / jpeg', and I tried to set the content type to Response Response and Integration Response.
Method Answer:

Integration Response:

source
share