Skip to content

Instantly share code, notes, and snippets.

@ShelbyZ
Created October 14, 2018 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShelbyZ/6f7e39050aa2ea80112fb54faa582b4d to your computer and use it in GitHub Desktop.
Save ShelbyZ/6f7e39050aa2ea80112fb54faa582b4d to your computer and use it in GitHub Desktop.
Twilio Function template loading and calling a loaded Asset
function log (data, message) {
try {
if (data && data.debug) {
console.log(message);
}
} catch (error) {
console.log(`Encountered error logging: ${error.message}`);
}
}
module.exports = {
log
};
exports.handler = function(context, event, callback) {
let path = Runtime.getAssets()['asset.js'].path;
let assetJS = require(path);
assetJS.log({
debug: true
}, 'asset test message');
callback(null, {});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment