I have backend event handlers that are not running how do I get it to run?


import wixStores from 'wix-stores-backend';
import wixUsersBackend from 'wix-users-backend';
import {roles} from 'wix-users-backend';

export function wixStores_onCartCreated(event){
    console.log("ignore me just testing something");   
 }

export function wixStores_onOrderPaid(event){
 	console.log(event.lineItems[0].productId);
 	const productBaseId = "5effd1bf-0c95-9396-e976-10c2bd3f0b8a";

 	const roleIdBFTC = "501b1ac6-7e44-4814-ac11-3d836f82a377";

 	const memberId = event.buyerInfo.id;
 	const productId = event.lineItems[0].productId;

 	if(productId === productBaseId){
 		let roleId = roleIdBFTC;
 		roles.assignRole(roleId, memberId);
 	}

}

I want any event handler to run, but when I create a cart and check the console there’s nothing

Do you have the event handlers in the backend events.js file?
Are you trying this in Live? Note that the events will not work in Preview.

Hello, thank you for the reply I managed to get it working it seems oncartcreated works in a weird way, it was in the events.js backend file