Skip to content

Instantly share code, notes, and snippets.

@rturk
Last active April 3, 2016 02:26
Show Gist options
  • Save rturk/01a2d43da94bb5290d7a8c7b332a2a79 to your computer and use it in GitHub Desktop.
Save rturk/01a2d43da94bb5290d7a8c7b332a2a79 to your computer and use it in GitHub Desktop.

Revisions

  1. rturk revised this gist Apr 3, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    /**
    * Middleware that log Koa errors to AWS SNS topic.
    * Sends a Message to AWS topic
    */

    import AWS from 'aws-sdk';
  2. rturk created this gist Apr 3, 2016.
    23 changes: 23 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    /**
    * Middleware that log Koa errors to AWS SNS topic.
    */

    import AWS from 'aws-sdk';

    const message = {
    test: "Test Message",
    error: "Error test",
    };

    var sns = new AWS.SNS({params: {TopicArn: 'arn:aws:sns:us-east-1:096957576271:brandlovers-server-error'}});

    console.log('sending log message to SNS');

    sns.publish({
    Message: JSON.stringify(message),
    MessageStructure: 'json',
    }, function(err, data) { if (err) {
    console.log(err.stack);
    return;
    }
    });