"Uncaught(in promise) error"

Hi

I am trying create a wishlist on my site. And I used a repeater to display my products. Following is my page code. It keeps throwing an error “Uncaught(inpromise) error” in my console and the code is not working as expected. I am attaching an image of the error. Could anyone help me in resolving this error? Any leads pointing to helpful documentation would also be very helpful.

import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;
import wixUsers from ‘wix-users’;

var userID;
let user = wixUsers.currentUser;
const linkField = “link-Toyscollection-skucode”;
let originalProductsInfo = ;

$w.onReady( function () {
//TODO: write your page related code here…
wixData.query(“ProductDatabase”)
.find()
.then((results) => {
originalProductsInfo = results.items;
console.log(originalProductsInfo);
$w(‘#repeater1’).data = originalProductsInfo;
})
. catch ((err) => {
let errorMsg = err;
});

 $w("#repeater1").onItemReady(($w, itemData) => { 
     $w("#text76").text = itemData.title; 
     $w("#image1").src = itemData.primaryimage; 
     $w("#text80").text = "" + itemData.points; 

let product_name = itemData.title;
let results1 = testwish(product_name).then((results) => {
let count = results.totalCount;
console.log(count);
if (count === 0) {
$w(“#AddtoHoppList”).label = “Add to HoppList”;
} else {
$w(“#AddtoHoppList”).label = “Remove from HoppList”;
}})
$w(“#image1”).onClick(()=>{wixLocation.to(itemData[linkField])});
$w(“#AddtoHoppList”).onClick(() => {
dothewish(itemData.title)
if ($w(“#AddtoHoppList”).label === “Remove from HoppList”)
$w(“#AddtoHoppList”).label = “Add to HoppList”;
else (
$w(“#AddtoHoppList”).label = “Remove from HoppList”);
})
});

})

function testwish(product_name) {
let userId = user.id;
return wixData.query(“Wishlist”)
.eq(“productId”, product_name)
.eq(“userId”, userId)
.find()
.then((results1) => {
console.log(results1);
return results1;
})}

Hi,

I can’t see any issues in your code.
I did notice a number of permission issues in your live site.
Make sure to set collection permissions correctly.