beforeSave not called after sync updates

I noticed that beforeSave is not called on updates on the automatic sync objects. Since the sync process updates (saves) data in realtime, why is that the case? My beforeSave trigger is only getting triggered on the very first save of a new object, but not on the updates. Is there any documentation given details about when exactly each triggers are getting called?

I have a beforeSave trigger for “_AddressSyncStatus”. New Objects get triggered once, but once it syncs updates like new transactions, it doesnt get triggered.

I would expect it to work on any update for that table

did you try only with a line with logger.info in beforeSave?

I have several logs in that beforeSave trigger. I just swapped some eth for wETH on one of these addresses so a transaction should get populated but the beforeSave is not triggered. Nor is the afterSave trigger.

Moralis.Cloud.beforeSave("_AddressSyncStatus", async request => {
  try {
    const balance = await Moralis.Web3API.account.getNativeBalance({
      address: request.object.get("address")
    });

    const ethBalance = await Moralis.Cloud.units({
      method: "fromWei",
      value: balance["balance"]
    });

    request.object.set("value", Number(ethBalance));

    logger.info("-------------------------------------------------");
    logger.info("-------------------------------------------------");
    logger.info(
      "beforeSave _AddressSyncStatus" + JSON.stringify(request.object)
    );
    logger.info("-------------------------------------------------");
    logger.info("-------------------------------------------------");
  } catch (error) {
    logger.info(error);
  }
});

can you add this line at the beginning of beforeSave?

changed it to this, still not log output or trigger


Moralis.Cloud.beforeSave("_AddressSyncStatus", async request => {
  logger.info("-------------------------------------------------");
  logger.info("-------------------------------------------------");
  logger.info("beforeSave _AddressSyncStatus" + JSON.stringify(request.object));
  logger.info("-------------------------------------------------");
  logger.info("-------------------------------------------------");
  try {
    const balance = await Moralis.Web3API.account.getNativeBalance({
      address: request.object.get("address")
    });

    const ethBalance = await Moralis.Cloud.units({
      method: "fromWei",
      value: balance["balance"]
    });

    request.object.set("value", Number(ethBalance));
  } catch (error) {
    logger.info(error);
  }
});

actually Im seeing the last_sync_completed shows date from yesterday although its historical_true and there are addresses in that table that have been active almost every minute

that may be only for historical sync, that historical sync runs once and after that real time sync handles the new transactions

is there a way to find out what is really the case? Cause we are considering a production server but need to make sure moralis suits our needs for the app.

answered in the other thread: Sync addresses not working