Skip to content

Instantly share code, notes, and snippets.

@alhafoudh
Last active August 29, 2015 14:10
Show Gist options
  • Save alhafoudh/9ce0edd1bac554845bf3 to your computer and use it in GitHub Desktop.
Save alhafoudh/9ce0edd1bac554845bf3 to your computer and use it in GitHub Desktop.
exports.handler = function(event, context) {
for (var i in event.Records) {
var record = event.Records[i];
console.log("Processing record");
var data = new Buffer(record.kinesis.data, 'base64').toString();
console.log("Input data: " + data);
var http = require('http');
http
.get(data, function(res) {
console.log("Got response: " + res.statusCode);
context.done(null); // I need to pass-in the context variable
})
.on('error', function(e) {
console.log("Got error: " + e.message);
context.done(e.message); // I need to pass-in the context variable
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment