My code works in preview but not in live site

I wrote a code to set the average score for each item in my repeater from a reviews dataset. The code works perfectly in the preview mode, but not in the published site. I need help with this because I do not understand what happens. By the way, datasets I use in my code have no restrictions (they are not set as read-only). My code below:

import wixData from 'wix-data';
import wixWindow from 'wix-window';

$w.onReady(async function() {
 // Get service availability to populate in the toggle.
    $w('#serviceRepeater').onItemReady(async ($item) => {
 // Populate the review score per psychologist.
 await wixData.query('Bookings/Services')
 .eq('serviceName', $item('#serviceName').text) // Query the serviceName to find Id.
 .find()
 .then(async (result) => {
 let psyId = result.items[0]._id;
            wixData.query('SubmitReviews') // Return/await ._id from Services to find psychologist reviews.
 .eq('medico', psyId)
 .include('medico') // Include referenced field in the search with ._id.
 .find()
 .then(async (results) => {
 let sum = 0;
 if(results.items.length > 0) {
 for(let i = 0; i < results.items.length; i++) {
                        sum = sum + results.items[i].calificacion;
 }
 let rating = (sum / results.totalCount).toFixed(1); // Declare rating and calculate score average to fixed(1).
                    $item('#reviewText').text = rating;
                    console.log(rating);
 }
 })
 .catch((error) => {
                console.log(error)
 })
 })
 .catch((error) => {
            console.log(error)
 })

 // Open a lightbox with more information about psychologist.
        $item('#psycoBoxButton').onClick(() => { // If user press more information button.
            wixWindow.openLightbox('Psychology Box', { // Open the Psychology lightbox.
 'psyNameSend': $item('#serviceName').text // Create an object with psychologist name from the imtem's repeater.
 })
 })
 })
})

-Check your DATABASE-PERMISSIONS.

-did you synced PREVIEW & LIVE?

Yes, both of them.

Why you use ASYNC, but do not —> AWAIT?

. then ( async ( result ) => { let psyId = result . items [ 0 ]. _id ; wixData . query ( ‘SubmitReviews’ ) // Return/await ._id from Services to find psychologist reviews. . eq ( ‘medico’ , psyId ). include ( ‘medico’ ) // Include referenced field in the search with ._id. . find (). then ( async ( results ) => {

You even commented it the right way.
Perhaps it is the issue in your case?

then ( async ( result ) => { let psyId = await result . items [ 0 ]. _id

Thank you for your interest in helping me. I fixed the async/await syntax but the problem persists. Have any other idea?

Did you already take a look into your CONSOLE to check for ERRORs?
Do you get some errors? If so, show the log (expanded).
Use the integrated BROWSER-CONSOLE of your browser.