Error 404 on Wix data update

Hi, I have the following code:

export function fetchOrder() {

  wixData.query("Stores/Orders")
    .find()
    .then((results) => {
      const firstResult = results.items[0];
      let toUpdate = {
        "_id":          firstResult._id,
        "buyerLanguage": "fr",
      };
      wixData.update("Stores/Orders", toUpdate)
        .then((response) => {
          console.log('success');
          console.log(response);
        })
        .catch((e) => {
          console.log(e);
        });
      } 
    );
 return;
}

It always ends up in the catch() and the error is:

Unknown error. Request ID: 1624433954.2523405571903426858. Message: Request failed with status code 404.

I’m not sure how to solve this. Anyone has encountered this previously?

Thanks!

The Stores collections has the following permissions:


Therefore, you cannot update or save to these collections, and you can only read from backend code that uses the suppressAuth option.

thanks for your answer @yisrael-wix !

Any recommendation on how to persist in the database an additional information related to an order?

To give you more details: I’m fetching orders from wix to sync them with a warehouse system. I need to save in wix for each order the warehouse system ID for this order. Any advice on how to do that?

Thanks!

You can add an additional collection that would keep the additional information and use the Order Id to link to this new collection.