I would like to be able to get usage data from Twilio from within an AWS Lambda function. I am following the examples on twilio's REST API page but am not having any success. I am using version 3 of Twilio's Node Helper Library. Below is the code that I have in the handler:
'use strict';
exports.handler = async(request, context) => {
const accountSid = 'my account sid';
const authToken = 'my auth token';
const client = require('twilio')(accountSid, authToken);
client.usage.records.today.each(record => console.log(record.count));
};
The Lambda "feels" like it is at least trying to get the data from Twilio. It runs for ~10 seconds before ending without any errors. However I never get the 'here' message.
Thanks in advance, Scott