Triggered Email sent sporadically

So I’ve been making a dynamic page email notification system that sends a triggered email to the page item’s email when a user completes a form. Here’s the page code:

import wixLocation from 'wix-location'
import wixCRM from 'wix-crm'

$w.onReady(function () {
$w("#rvpDataset").onReady(() => {
    let rvp = $w("#rvpDataset").getCurrentItem()
    let recruitCollection = $w("#recruitCollection")
    console.log(rvp['name'])

    $w('#validationMessages').collapse()

    $w('#submit').onClick(() => {
        if (validateInfo()) { //double checks that the inputted values are correct
                recruitCollection.setFieldValues({
                    'firstName': $w("#firstName").value,
                    'lastName': $w("#lastName").value,
                    'email': $w("#email").value,
                    'phone': $w("#phoneNumber").value,
                    'invitedHere': $w("#inviteHere").value,
                    'comment': $w("#comments").value,
                    'rvp': rvp['name'],
                })

                wixCRM.createContact({
                    "emails": [rvp['notifyEmail']],
                }).then((contactId) => {
                    wixCRM.emailContact('S6EtACv', contactId, {
                        variables: {
                            rvpName: rvp['name'],
                            invitedBy: $w("#inviteHere").value,
                            phoneNumber: $w("#phoneNumber").value,
                            email: $w("#email").value,
                            recruitName: $w("#firstName").value + " " + $w("#lastName").value,
                            videoName: "Ever Wondered..."
                        }
                    })
                    }).then(() => {
                        console.log("email sent to " + rvp['email'])
                        recruitCollection.save()
                        wixLocation.to(rvp['link-rvp-pages-name'])
                })
            }
        })
    })
})

For some weird reason I can’t understand, the triggered email is only sent out some of the time, not consistently. Does anyone know what could be causing this, and/or how to fix this?

I’m new to coding, so if I’m missing any information to help solve this problem please let me know!

Thanks in advance for any help!