Getting {code: 500, message: "BOOKINGS_SYSTEM_ERROR"}

I am creating a booking website and when I am going to query for database collection for all pending appointments, I am getting this error:

{code: 500, message: “BOOKINGS_SYSTEM_ERROR”}

Below is my code snippet:

async function findpendingappointments() {
    console.log("we are in findpendingappointments")
 return (await wixData.query("newAppointements").find()).items.filter(item => item.status === "PENDING");

}

Below is error in console:


{code: 500, message: “BOOKINGS_SYSTEM_ERROR”}code: 500message: "BOOKINGS_SYSTEM_ERROR"proto: constructor: ƒ Object()hasOwnProperty: ƒ hasOwnProperty()isPrototypeOf: ƒ isPrototypeOf()propertyIsEnumerable: ƒ propertyIsEnumerable()toLocaleString: ƒ toLocaleString()toString: ƒ toString()valueOf: ƒ valueOf()defineGetter: ƒ defineGetter()defineSetter: ƒ defineSetter()lookupGetter: ƒ lookupGetter()lookupSetter: ƒ lookupSetter()get proto: ƒ proto()set proto: ƒ proto()
r @ altzc.js?empty-if-missing=true&exclude=wix-&module-name=altzc:1
(anonymous) @ altzc.js?empty-if-missing=true&exclude=wix-&module-name=altzc:1
Promise.then (async)
r @ altzc.js?empty-if-missing=true&exclude=wix-&module-name=altzc:1
(anonymous) @ altzc.js?empty-if-missing=true&exclude=wix-&module-name=altzc:1
(anonymous) @ altzc.js?empty-if-missing=true&exclude=wix-&module-name=altzc:1
(anonymous) @ altzc.js?empty-if-missing=true&exclude=wix-&module-name=altzc:1
h @ altzc.js?empty-if-missing=true&exclude=wix-&module-name=altzc:1
(anonymous) @ altzc.js?empty-if-missing=true&exclude=wix-&module-name=altzc:1
safeRun @ ua-parser.js:1
(anonymous) @ ua-parser.js:1
trigger @ ua-parser.js:1
(anonymous) @ ua-parser.js:1
value @ ua-parser.js:1
(anonymous) @ ua-parser.js:1
u @ bookingsViewerScript.bundle.min.js:1
eval @ bookingsViewerScript.bundle.min.js:1
forEach.t. @ bookingsViewerScript.bundle.min.js:1
asyncGeneratorStep @ ua-parser.js:1
_next @ ua-parser.js:1
Promise.then (async)
asyncGeneratorStep @ ua-parser.js:1
_next @ ua-parser.js:1
Promise.then (async)
asyncGeneratorStep @ ua-parser.js:1
_next @ ua-parser.js:1
(anonymous) @ ua-parser.js:1
_handleStart @ ua-parser.js:1
_handleStart @ ua-parser.js:1
(anonymous) @ ua-parser.js:1
(anonymous) @ lodash.min.js:67
(anonymous) @ bolt-worker.js:1
u @ bookingsViewerScript.bundle.min.js:1
eval @ bookingsViewerScript.bundle.min.js:1
forEach.t. @ bookingsViewerScript.bundle.min.js:1
asyncGeneratorStep @ bolt-worker.js:1
_next @ bolt-worker.js:1
(anonymous) @ bolt-worker.js:1
_processMessage @ bolt-worker.js:1
(anonymous) @ bolt-worker.js:1
(anonymous) @ ua-parser.js:1
(anonymous) @ ua-parser.js:1
o @ ua-parser.js:1
handle @ ua-parser.js:1
(anonymous) @ bolt-worker.js:1
self.onmessage @ bolt-worker.js:1
{code: 500, message: “BOOKINGS_SYSTEM_ERROR”}code: 500message: "BOOKINGS_SYSTEM_ERROR"proto: constructor: ƒ Object()hasOwnProperty: ƒ hasOwnProperty()isPrototypeOf: ƒ isPrototypeOf()propertyIsEnumerable: ƒ propertyIsEnumerable()toLocaleString: ƒ toLocaleString()toString: ƒ toString()valueOf: ƒ valueOf()defineGetter: ƒ defineGetter()defineSetter: ƒ defineSetter()lookupGetter: ƒ lookupGetter()lookupSetter: ƒ lookupSetter()get proto: ƒ proto()set proto: ƒ proto()
r @ altzc.js?empty-if-missing=true&exclude=wix-&module-name=altzc:1
(anonymous) @ altzc.js?empty-if-missing=true&exclude=wix-&module-name=altzc:1
Promise.then (async)
r @ altzc.js?empty-if-missing=true&exclude=wix-&module-name=altzc:1
(anonymous) @ altzc.js?empty-if-missing=true&exclude=wix-&module-name=altzc:1
(anonymous) @ altzc.js?empty-if-missing=true&exclude=wix-&module-name=altzc:1
(anonymous) @ altzc.js?empty-if-missing=true&exclude=wix-&module-name=altzc:1
h @ altzc.js?empty-if-missing=true&exclude=wix-&module-name=altzc:1
(anonymous) @ altzc.js?empty-if-missing=true&exclude=wix-&module-name=altzc:1
safeRun @ ua-parser.js:1
(anonymous) @ ua-parser.js:1
trigger @ ua-parser.js:1
(anonymous) @ ua-parser.js:1
value @ ua-parser.js:1
(anonymous) @ ua-parser.js:1
u @ bookingsViewerScript.bundle.min.js:1
eval @ bookingsViewerScript.bundle.min.js:1
forEach.t. @ bookingsViewerScript.bundle.min.js:1
asyncGeneratorStep @ ua-parser.js:1
_next @ ua-parser.js:1
Promise.then (async)
asyncGeneratorStep @ ua-parser.js:1
_next @ ua-parser.js:1
Promise.then (async)
asyncGeneratorStep @ ua-parser.js:1
_next @ ua-parser.js:1
(anonymous) @ ua-parser.js:1
_handleStart @ ua-parser.js:1
_handleStart @ ua-parser.js:1
(anonymous) @ ua-parser.js:1
(anonymous) @ lodash.min.js:67
(anonymous) @ bolt-worker.js:1
u @ bookingsViewerScript.bundle.min.js:1
eval @ bookingsViewerScript.bundle.min.js:1
forEach.t. @ bookingsViewerScript.bundle.min.js:1
asyncGeneratorStep @ bolt-worker.js:1
_next @ bolt-worker.js:1
(anonymous) @ bolt-worker.js:1
_processMessage @ bolt-worker.js:1
(anonymous) @ bolt-worker.js:1
(anonymous) @ ua-parser.js:1
(anonymous) @ ua-parser.js:1
o @ ua-parser.js:1
handle @ ua-parser.js:1
(anonymous) @ bolt-worker.js:1
self.onmessage @ bolt-worker.js:1


When dig into this error it points out to me at “import wixData from ‘wix-data’;” statement.

Please suggest.

Thanks in advance.