Getting an Internal Server Error (500) while creating contact with wixCRM

Hello there,

I am using the createContact function to create a contact with only a string as the email address. When the function is called it returns an unfulfilled promise logging the error code “Internal Server Error (500)”.

The code looks a bit like this (of course it does a bit more than just creating the contact):

function sendEmails() {
 return new Promise(
        (resolve, reject) => {
            wixCRM.createContact({ "emails": [clientEmail] })
                .then(
                    (contactId) => {
                        wixData.query("foo").find().then(
                            (results) => {
                                wixCRM.emailContact('oof', contactId, { variables: { ... } });
                                resolve(true);
                            }

                        ).catch(
                            (err) => {
                                console.log(err);
                                reject(true);
                            });
                    }).catch(err => console.log(err));
        });
}

It’s worth mentioning that I have not published the site yet, only the email I created on the Triggered Emails tab. Could the error be caused due to this or is it my code which is wrong?