I’m having trouble with
events.js in backend
Working in
Wix Editor, Dev Mode, CMS, etc.
Site link
What I’m trying to do
I am getting no events registered in the console logs from my events.js data. Nothing worked so far. The goal is to register when a priceplan is bought and run code.
What I’ve tried so far
Tried various wix-pricing-plans APIs
Extra context
I need to test somehow if an event is even registered, because even when I am doing a data insert event in any cms collection, I get no logs from events.js. Here is the following example:
events.js:
import wixData from 'wix-data';
export function wixData_onAfterInsert(event) {
console.log('========================================');
console.log('!!!!! WIXDATA INSERT EVENT FIRED !!!!!');
console.log('Timestamp:', new Date().toISOString());
console.log('========================================');
console.log('Collection:', event.collectionName);
console.log('Item:', JSON.stringify(event.item, null, 2));
console.log('========================================');
}
frontend code for the test site when a button is pressed:
import wixData from 'wix-data';
$w.onReady(function () {
// Test-Button (füge einen Button mit ID #testButton hinzu)
$w('#testButton').onClick(() => {
testEvent();
});
});
async function testEvent() {
console.log('🧪 Testing event...');
try {
await wixData.insert('TestEvents', {
message: 'Test event fired at ' + new Date().toISOString()
});
console.log('✅ Test item inserted - check backend logs!');
} catch (error) {
console.error('❌ Error:', error);
}
}
It is very frustrating, because somehow the events.js is never called.

