"Failed to fetch" when sending triggered email

This is from the same site as the code sample from above and you can see it is still done after a onAfterSave which runs after the user inputs are saved into the dataset.

import wixCRM from 'wix-crm';

$w.onReady(function () {
$w("#PublicContactUs").onAfterSave(() => {
let name = $w('#publiccontactName').value;
let email = $w("#publiccontactEmail").value;
let subject = $w("#publiccontactSubject").value;
let message = $w("#publiccontactMessage").value;
let label = ["Contacted Us"];

wixCRM.createContact({ 
"name": name,
"emails": [email]

}) 
.then((contactId) => { 
// Need to use the triggered email name
return wixCRM.emailContact('publiccontactus', contactId, { 
"variables": { 
// Need to use the triggered email variable names
"name": name,
"email": email, // << - correct variable is email not emails
"subject": subject,
"message": message
} 
}); 
}) 
.catch((err) => { 
// handle the error if the email wasn't sent
console.log(`Error: ${err}`);
}); 
}); 
}); 

$w("#NewSubscriber").onAfterSave(() => {
let name = $w("#newsubscriberName").value;
let email = $w("#newsubscriberEmail").value;
let privacyPolicy = $w("#newsubscriberPrivacy").value;
let label = ["Subscribed"];

wixCRM.createContact({ 
"name": name,
"emails": [email]

}) 
.then((contactId) => { 
// Need to use the triggered email name
return wixCRM.emailContact('newsubscriber', contactId, { 
"variables": { 
// Need to use the triggered email variable names
"name": name,
"email": email, // << - correct variable is email not emails
//"privacyPolicy": privacyPolicy << - not defined in the triggered email
} 
}); 
}) 
.catch((err) => { 
// handle the error if the email wasn't sent
console.log(`Error: ${err}`);
}); 
});