Sms and email don't work together

Hello there,

I stumbled upon an issue that i can’t solve. I am using the twilio api at the moment with the sms api.
Both work together seperatly, but when i add them together, i get the following error:
“Unhandled promise rejection Error”.
Even if i add a timer to put them seperetly,one will work, the other won’t.
What am i doing wrong?


$w.onReady( function () {
$w(“#dataset1”).onAfterSave(sendFormData);
});
function sendFormData() {
const subject = text;
const body = text;
const recipient = $w(“#input2”).value;
sendEmailWithRecipient(subject, body, recipient)
.then(response => console.log(response));
}
export function dataset1_afterSave() {
//SMS
setTimeout( function (){
const SMSMessage = “text”;
const number = $w(“#input3”).value;
sendSms(SMSMessage, number);
}, 7000);
}

Try this maybe

$w.onReady(function () {

});

export function dataset1_afterSave() {
    sendFormData();
}

function sendFormData() {
const subject = `text`;
const body = ` text `;
const recipient = $w("#input2").value;
sendEmailWithRecipient(subject, body, recipient)
.then((response) => {
    sms();
  });
}
function sms() {
 const SMSMessage = "text";
 const number = $w("#input3").value;
    sendSms(SMSMessage, number);
}

Hello there,
It works perfectly, thank you.