Skip to content

Instantly share code, notes, and snippets.

@sharpred
Last active February 20, 2017 16:12
Show Gist options
  • Save sharpred/d97c4f84b11d957bb1050deaa91065e5 to your computer and use it in GitHub Desktop.
Save sharpred/d97c4f84b11d957bb1050deaa91065e5 to your computer and use it in GitHub Desktop.
run webtask code with token claims
return function (context, cb) {
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: context.secrets.ACCESS_KEY,
secretAccessKey: context.secrets.SECRET_KEY,
region: 'eu-west-1'
});
var sns = new AWS.SNS();
var params = {
Message: 'web token test',
TopicArn: context.secrets.TOPIC_ID,
Subject: 'web token test'
};
sns.publish(params, function (err, data) {
if (err) {
console.error("error");
cb(null, err);
} else {
console.log("ok");
cb(null, data);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment