Problems with Wix Blocks

Hi, Im not sure what is the problem, but I have my own package in Wix Blocks, the code is working if i put it normally to backend files, but if I move it to the package, it doesnt work.
I did some experiments and even if i strip all code exept imports and logging, the code doesnt work.

Meaning this is the result and even this doesn’t work. I test it by editing of the product, which should log “onProductUpdated fired”. It doesn’t do anything.

And once again: if I even uncomment all the code and put it to events.js in backend scripts, everything is working fine. Just if I go the installed package way, it doesn’t work even with this barebone version…

Is there any caveat to look for? I build the version, install update, publish website, make product edit and nothing happens (i look at both logging panel in administration and I have Google Operations linked and working)

/* backend: events.js */
import wixStoresBackend from 'wix-stores-backend';
import wixData from 'wix-data';
import {getSecret} from 'wix-secrets-backend';
import {fetch} from 'wix-fetch';
import convert from 'xml-js';

export async function wixStores_onProductUpdated(event) {
  console.log('onProductUpdated fired');
}

export async function wixStores_onNewOrder(event) {
  console.log('onNewOrder fired');
  /*
  commented code
  */
}

export async function wixStores_onOrderPaid(event) {
  console.log('onOrderPaid fired');
  /*
  commented code
  */
}

Can you please check the code file? The name should be events.js (exact same)

If yes, please contact wix support.

This function only run when order is mark as paid manually

The onOrderPaid

Yes I know, but I basically assume that if wixStores_onProductUpdated doesnt execute when I edit the product, the whole script is not ok. So I am testing this by editing the product.

Emm… that’s weird, can you try other events? If still not working, contacting wix support will be a good way

I did one more thing (i hope it is correct…)
Now i have the working code in events.js in local backend

  • i installed the package with the code mentioned above.

I have changed the logginng texts so i know which is triggered from which component.

So I assume the correct situation would be that I would get both logs from local events.js + from installed package’s events.js.

Only local log is triggered though. I contacted the support, so we will work it out hopefully. Thanks for the tips.