Is afterInsert really after insert?

This is how I overcame the problem btw:

export async function Credit_beforeInsert(item, context) {
    item["affiliatesCount"] = 1;
    item.email = item.email.toLowerCase();
    item._id = item.email.toLowerCase();
    item.monthlySpending = parseInt(item.monthlySpending, 10);
 try{
      item.contactId = await wixCrmBackend.createContact({
 "firstName": item['email'],
 "emails": [item['email']]
 });
      console.log("Contact created successfuly. Email: " + item.email);
 } catch(error){
      console.log("Error while trying to create contact: " + error + ". Email: " + item.email);
 }
 return item;
}

I deleted the afterInsert hook and used await to store the contactId in the item in the beforeInsert hook.

Still interested to know why the error occurred in the first place though…