Created
October 14, 2018 18:04
-
-
Save ShelbyZ/6f7e39050aa2ea80112fb54faa582b4d to your computer and use it in GitHub Desktop.
Twilio Function template loading and calling a loaded Asset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function log (data, message) { | |
try { | |
if (data && data.debug) { | |
console.log(message); | |
} | |
} catch (error) { | |
console.log(`Encountered error logging: ${error.message}`); | |
} | |
} | |
module.exports = { | |
log | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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