Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': #<Promise> could not be cloned.

Hello i am trying to generate a csv file and everything was working fine until i wanted to fill real data into the fields and then i had to use async function and await to make sure all fields were filled and from now on i can’t figure out why i have this error(Failed to execute ‘postMessage’ on ‘DedicatedWorkerGlobalScope’: # could not be cloned.).
Here’s the code :

export async function button4_click ( event ) {
$w ( ‘#button4’ ). disable ();
let nbitems = 0 ;
let itemssmall ;
wixData . query ( “ReponsesFormulaireDefinitive” )
. ne ( “idFormulaireTemporaire” , undefined )
. find ()
. then (( results )=>{
if ( results . totalCount > 0 )
{
nbitems = results . totalCount ;
console . log ( “before postmessage” );
itemssmall = FormatDataForExcel ( results . items ). then (( t )=>{
downloadcsv ( itemssmall );
})
console . log ( “after postmessage” );
}
}). then (( t )=>
{
$w ( ‘#button4’ ). enable ();
})
}

async function downloadcsv ( data )
{
$w ( ‘#html1’ ). postMessage ( FormatDataForExcel ( data ));
}

async function FormatDataForExcel ( items )
{
if ( items . length > 0 ) {
let TableData = [];

  // Add one row at a time to the TableData array by looping through the query results. 
  console . log ( items . length ); 
  console . log ( items ); 
  **await**  items . forEach ( **async**  item  => { 
    **let**  nombre500  =  **await**  getnb50 0 ( item . idFormulaireTemporaire ); 
    **let**  nombre501  =  **await**  getnb501 ( item . idFormulaireTemporaire ); 
    **let**  nombreMT  =  **await**  getnbMT ( item . idFormulaireTemporaire ); 
    **let**  nombre500P  =  **await**  getnb500P ( item . idFormulaireTemporaire ); 
    **let**  TableRowData  = { "ID" :  item . _id , 
    "N°ECOCERT/AGROCERT/LACON" :  item . numeroDIdentificationBioCe , 
    "Domaine" :  item . nomDuDomaineNomCommercialSousLequelVotreDomaineEstConnu , 
    "Société" :  item . identificationRaisonSociale , 
    "Responsable" :  item . nomDuRepresentantEtFonction , 
    "Adresse : rue" :  item . adressePostale , 
    "Adresse : code postal" :  item . codePostal , 
    "Adresse : commune" :  item . ville , 
    "Région" :  "A ajouter la recup par rapport au code postal" , 
    "Entrée dans Biodyvin" :  item . premiereAnneeBioHorsPeriodeConversion , 
    "Date de contrôle 2019" :  **await**  toNormalDate ( item . periodeDeclareeDateDuDernierControle ), 
    "Surf. Ecocert" :  "A AJOUTER" , 
    "BIODYVIN" :  item . totalSurfaceEnBiodyvin , 
    "C3+C2+C1" :  item . totalEnConversionBiodyvin , 
    "C3" :  item . vignesEn3EmeAnneeDeConversion , 
    "C2" :  item . vignesEn2EmeAnneeDeConversion , 
    "C1" :  item . vignesEn1EreAnneeDeConversion , 
    "Date de contrôle 2020" :  **await**  toNormalDate ( item . periodeDeclareeDateDuControle2021 ), 
    "N500" :  nombre500 , 
    "N501" :  nombre501 , 
    "NMT" :  nombreMT , 
    "N500P" :  nombre500P , 
    "Moyenne Cuivre" :  item . doseMoyenneDeCuivreMetalPourLAnneeEnKgHa2Decimales , 
    "Soufre" :  item . doseMoyenneDeSoufrePourLAnneeEnKgHa2Decimales , 
    "PRODUITS OENO" :  "A AJOUTER" , 
    "A" :  **await**  isSituationA ( item . laSituationAEstCelleOuLaStructureJuridiqueAdherenteMetElleMmeSaProductionEnBouteillesAuMoinsEnPartieEtesVousDansLaSituationA ), 
    "B" :  **await**  isSituationB ( item . laSituationBEstCelleOuLeDomaineAdherentCommercialiseToutOuUnePartieDeSaProductionBiodyvinSousFormeDeRaisinsMotsOuVinsEnVracAUneSocieteDeNegoceTransformationControleeParLuiSurLaDefinitionDuControleDUneSocieteDeNegoceTransformationVoirLOngletPresentationtesVousDansLaSituationB ), 
    "C" :  **await**  isSituationC ( item . laSituationCEstCelleOuLeDomaineAdherentCommercialiseToutOuUnePartieDeSaProductionSousFormeDeRaisinsMotsOuVinsEnVracAUnAutreAdherentBiodyvinOuAUneOuPlusieursSocieteDeNegoceTransformationControleeParUnAutreAdherentBiodyvinRelevezVousDeLaSituationC ), 
    "D" :  **await**  isSituationD ( item . laSituationDEstCelleOuLeDomaineAdherentControleUneSocieteDeNegoceTransformationALaquelleIlNeVendNiRaisinNiMotNiVracSurLaDefinitionDuControleDUneSocieteDeNegoceVoirLaPartiePresentationRelevezVousDeLaSituationD ), 
    "E" :  **await**  isSituationE ( item . laSituationELeDomaineAdherentARecoursAUnFaconnierCEstADireUnFournisseurQuiEffectueDesPrestationsDeServicesRelevantDuProcessusDeVinificationElevageEmbouteillage ), 
    "COMMENTAIRES" :  "A AJOUTER" , 
    "logo" :  item . laMarqueEtLeLogoBiodyvinFigurentIlsSurLEtiquetteOuLaContreEtiquetteDesVinsDOrigine100Biodyvin , 
    "Conforme" :  "" , 
    "Nom de la société négoce non-adhérente" :  "A AJOUTER" , 
    "ETIQUETAGE DIFFERENT " :  "A AJOUTER" , 
    "Traçabilitée respectée" :  "A AJOUTER" , 
    "Vinif avec vins conventionnels" :  "A AJOUTER" , 
    "LOCAUX SEPARE" :  "A AJOUTER" , 
    "Achats vins en conventionnel" :  "A AJOUTER" , 
    "LOGO BIODYVIN sur les étiquettes " :  "A AJOUTER" , 
    "Achat uniquement bouteilles du domaine" :  "A AJOUTER" , 
    "COMMENTAIRES2" :  "A AJOUTER" , 
    "CONFORME" :  "" 
    } 
        TableData . push ( TableRowData ); 
  }) 
  console . log ( TableData ); 
**return**  TableData ; 
} 

}

async function isSituationA ( valeur )
{
if ( valeur == “Radio button1” )
{
return “A” ;
} else return “” ;
}
async function isSituationB ( valeur )
{
if ( valeur == “Radio button1” )
{
return “B” ;
} else return “” ;
}
async function isSituationC ( valeur )
{
if ( valeur == “Radio button1” )
{
return “C” ;
} else return “” ;
}
async function isSituationD ( valeur )
{
if ( valeur == “Radio button1” )
{
return “D” ;
} else return “” ;
}
async function isSituationE ( valeur )
{
if ( valeur == “Radio button1” )
{
return “E” ;
} else return “” ;
}

async function toNormalDate ( input )
{
let date = new Date ( input );
return date . toLocaleDateString ();
}

async function getnb500 ( idform )
{
wixData . query ( “PassagePreparation” )
. eq ( “idFormulaire” , idform )
. find ()
. then (( results )=>{
return results . totalCount . toString ();
})
return 0 ;
}

async function getnb501 ( idform )
{
wixData . query ( “PassagePreparation” )
. eq ( “idFormulaire” , idform )
. find ()
. then (( results )=>{
return results . totalCount . toString ();
})
return 0 ;
}

async function getnbMT ( idform )
{
wixData . query ( “PassagePreparation” )
. eq ( “idFormulaire” , idform )
. find ()
. then (( results )=>{
return results . totalCount . toString ();
})
return 0 ;
}

async function getnb500P ( idform )
{
wixData . query ( “PassagePreparation” )
. eq ( “idFormulaire” , idform )
. find ()
. then (( results )=>{
return results . totalCount . toString ();
})
return 0 ;
}

The issue was that the data was not totaly processed when i called the $w(‘#html1’).postmessage(item) function so i solved this by putting the data recuperation in the onready function so the button only get a variable already filled and just post it to the html