wixData stopped working properly

Details:

Code that’s been working for a year has stopped working today. The issue stems from using wixDats. I created a simple function, and it seems like even the most basic, simple queries on wixData aren’t working.

This is the type of errors I get in the developes tools log: “_wixData.default.query(…).limit is not a function” _wixData.default.query(…).find is not a function

My code:

import wixData from ‘wix-data’;
const options = { “suppressAuth”: true, };

export function test() {
wixData.query(“Members”) .limit(10) .find(options) .then((results) => {
console.log(“working”, results)
}) }

Hi! It is possible that the error you are seeing is occurring because the wixData module is not properly imported or because the query function is not being called correctly.

Thank you for trying to help, but the code you wrote is exactly the same as mine (I don’t see any difference).

I used:
import wixData from ‘wix-data’;

To import the module and called it just like you did.

I genuinely don’t see the difference in the code you suggested. Can you point it out?

I did copy and paste the code you wrote, but it’s exactly the same, so I’m getting the same error. Keep in mind that code has been working for 6 months straight and stopped working yesterday.

Thank you

I wrote the simplest function just for testing purposes (literally copied it from the documentation) and it’s still not working:

Page code:
import { test } from ‘backend/collections/tests’ ;

$w . onReady ( function () {
test (). then ( res => { console . log ( res )})
});

Backend code (tests.jsw):

import wixData from ‘wix-data’ ;

export function test ( ) {
wixData . query ( “log” )
. find ()
. then ( ( results ) => {
console . log ( results . items );
return results . items ;
} );
}

the “log” collection is public. Still not working! getting the following error:

_wixData.default.query(…).find is not a function

Please help!!!

return wixData . query ( “log” ). find (). then (( results )=>{ console . log ( results . items ); return results . items ;});

You missed return (in red text) so the data is not returned to the frontend!