Trouble adding new form information to an existing contact from a form.

The functionality I want exists completely in preview mode. On form submission the fields/labels of the existing contact are set to the values from the submission, and the contact is added into a workflow.


But when the site is live and the user is not logged in to the site, it will only create the new contact or return the ID after finding it but not update it or add to the workflow giving this error instead

"Error at
 i (..../services/wix-code-platform/1.964.0/wixCodeNamespacesAndElementorySupport.min.js:1:74043) 

at XMLHttpRequest.n.onreadystatechange (....services/wix-code-platform/1.964.0/wixCodeNamespacesAndElementorySupport.min.js:1:74663) 

at XMLHttpRequest.wrapped node_modules/viewer-platform-worker/dist/bolt-worker.js:16:237405)" 

Here is my code handling contact creation after receiving the form input on the page:

import { updateContact } from "backend/workFlowManager.jsw";
import { contacts } from 'wix-crm';

let userId =  await contacts.appendOrCreateContact(contactInfo)
                .then((updatedContact) =>{
                        updateContact( updatedContact.contactId, contactInfo, workflowPhase);
                        return updatedContact.contactId;
                })

Here is my code handling updating the contact and adding it to the workflow in a jsw back end module on the site.

import wixCrm from 'wix-crm-backend';

export async function updateContact(userId, contactInfo, workflowPhase){
let revision = await getContactRevision(userId);
let contactIdentifiers = await  {
  contactId: userId,
  revision: revision
}
const options = {
      allowDuplicates: true,
      suppressAuth: true
}

await wixCrm.contacts.updateContact( contactIdentifiers, contactInfo, options)
    .then((updatedContact) => {
      console.log(updatedContact)
    })
    .catch((error) => {
      console.error(error);
    });

    addToWorkflow(userId, workflowPhase);
}
///////
async function getContactRevision(id){
  const optionsGetContact = {
  suppressAuth: true
  };
  let contact = await wixCrm.contacts.getContact(id, optionsGetContact);

  return contact.revision;
}

Is it just not possible to trigger these back end function from the client side. Is there a work around?