Skip to content

Instantly share code, notes, and snippets.

@mrlynn
Last active July 22, 2018 21:18
Show Gist options
  • Save mrlynn/f0cd325e223d0b622280e37659d12607 to your computer and use it in GitHub Desktop.
Save mrlynn/f0cd325e223d0b622280e37659d12607 to your computer and use it in GitHub Desktop.
Example MongoDB Stitch Serverless Function to call an Amazon Kinesis to put a record
exports = function(event){
const awsService = context.services.get('aws');
console.log(JSON.stringify(event.fulldocument));
try{
awsService.kinesis().PutRecord({
Data: JSON.stringify(event.fullDocument),
StreamName: "stitchStream",
PartitionKey: "1"
}).then(function(response) {
return response;
});
}
catch(error){
console.log(JSON.parse(error));
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment