I'm trying to display Twilio data in my template view, list all of the messages sent using the Twilio API for my account. All this in Nativescript-Vue. My code looks like this
<template>
<Page>
<ActionBar title="API TEST/>
<ScrollView>
<StackLayout>
<StackLayout :key="message.sid" v-for="message in myMessages">
<Label :text="message.body" />
<Label :text="message.from" />
<Label :text="message.to " />
</StackLayout>
</StackLayout>
</ScrollView>
</Page>
</template>
<script>
const Twilio = require('twilio');
const client = new Twilio("[my accountSid]","[my authToken]");
export default {
data() {
return {
myMessages: []
}
},
created() {
this.getList();
},
methods:
{
getList() {
client.messages
.list()
.then(messages => messages.forEach(m => this.myMessages.push(m))
)
.catch(err => console.error(err));
}
}
}
</script>
When I run tns run android
I get the following error
System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to create application com.tns.NativeScriptApplication:com.tns.NativeScriptException: Error calling module function
System.err: TypeError: Cannot read property 'split' of undefined
System.err: File: (file:///node_modules\pbkdf2\lib\default-encoding.js:6:47)
Thanks in advance for the help!