The code works on preview but not work on Live Site

 import wixData from 'wix-data';

 $w.onReady(function () {

 $w('#button5').onClick(searchButton_click);

});

export function searchButton_click(event) { 
search();
}

function search() {
const searchValue =  $w("#idinput").value;
const emailValue = $w("#numberinput").value

wixData.query("Checkout")
    .eq("orderid", searchValue)
    .eq("Phone", emailValue)
    .find()
    .then(results => {
       if (results.items.length === 0) {
           
            $w("#text98").show();
            
             // Show the text eleme Clear the repeater
        } else {
            
            $w("#text98").hide();// Hide the text element
            $w("#name").text = results.items[0].First_Name;
            $w("#number").text = results.items[0].Phone;
            $w("#name").text = results.items[0].First_Name;
            $w("#A1").text = results.items[0].Address_1;
            $w("#A2").text = results.items[0].Address_2;
            $w("#city").text = results.items[0].City;
            $w("#state").text = results.items[0].State;
            $w("#zip").text = results.items[0].Zip_Code;
            $w("#email").text = results.items[0].Email;
            $w("#orderidtext").text = results.items[0].orderid;
            $w("#date").text = results.items[0]._createdDate;
            $w("#productText").text = results.items[0].Item;
            $w("#productline").text = results.items[0].ProductLine;
            $w("#text70").text = results.items[0].Price;
            $w("#text78").text = results.items[0].Price;
            $w("#text77").text = results.items[0].Price;
            $w("#imageX1").src = results.items[0].Image; // Populate the repeater
        }

    })
    ;

}

I dont Know this code works fine in preview and not in the Published site.

Check → PERMISSIONS → DATABASE.