Here’s an example from Function Lambda, however, it’s good that you capture your Function logs with Cloudwatch and analyze because you might not even be getting to Function Lambda.
var AWS = require('aws-sdk');
var s3Bucket = new AWS.S3({ params: { Bucket: 'seuBucket' } });
exports.handler = function(event, context, callback) {
var buf = new Buffer(event.avatar.base.replace(/^data:image\/\w+;base64,/, ""), 'base64');
var data = {
Key: 'avatar/edimar.png',
Body: buf,
ContentEncoding: 'base64',
ContentType: 'image/webp'
};
s3Bucket.putObject(data, function(err, data) {
if (err) {
console.log(err);
console.log('Error uploading data: ', data);
}
else {
console.log('succesfully uploaded the image!');
callback(err, 'ok');
}
});
}
To my knowledge, lambda AWS is not a function, but it is a serverless service in which you provide an end-point to do some processing. So I found the description very strange
lambda function
in the title/body of the text. Without more details of your test, of your up-to-date end-point code, I don’t see how anyone without a crystal ball could help. A priori, AWS should provide you with enough working memory space for you to be able to doPOST
arbitrary in size, but more detail is needed to say anything– Jefferson Quesado