# Events are not firing in events.js - what can I do to test an event to be sure my events.js is working?

**URL:** <https://forum.wixstudio.com/t/events-are-not-firing-in-events-js-what-can-i-do-to-test-an-event-to-be-sure-my-events-js-is-working/74624>\
**Category:** Ask the community\
**Tags:** wix-data, wix-events, code, cms, wix\
**Created:** [October 29, 2025, 4:29pm UTC](https://forum.wixstudio.com/t/events-are-not-firing-in-events-js-what-can-i-do-to-test-an-event-to-be-sure-my-events-js-is-working/74624 "2025-10-29T16:29:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yannick\_Bromme](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/yannick_bromme/32/106149_2.png) [@Yannick\_Bromme](https://forum.wixstudio.com/u/Yannick_Bromme)\
**Post date:** [October 29, 2025, 4:29pm UTC](https://forum.wixstudio.com/t/events-are-not-firing-in-events-js-what-can-i-do-to-test-an-event-to-be-sure-my-events-js-is-working/74624/1 "2025-10-29T16:29:24Z")

</div>

**I’m having trouble with**  
events.js in backend

**Working in**  
Wix Editor, Dev Mode, CMS, etc.

**Site link**

> **[HOME | Hermanai Solutions](https://www.hermanai.de/)**

**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:

```javascript
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:

```javascript
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.

---

<div class="post-metadata">

**Author:** ![Rob](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/rob/32/84134_2.png) [@Rob](https://forum.wixstudio.com/u/Rob)\
**Post date:** [October 29, 2025, 6:53pm UTC](https://forum.wixstudio.com/t/events-are-not-firing-in-events-js-what-can-i-do-to-test-an-event-to-be-sure-my-events-js-is-working/74624/2 "2025-10-29T18:53:06Z")

</div>

I’m unsure if this is a supported flow but on checking the code and documentation, I only say [afterInsert](https://dev.wix.com/docs/velo/apis/wix-data/hooks/after-insert) instead of onAfterInsert within the Velo documentation.

I was able to able to get the second half (the frontend code) seems to be working in terms of logging in the front end and the logs.

 ![2025-10-29_14-51-21](https://us1.discourse-cdn.com/wix/original/3X/4/0/4010a19b5fe1a71c572104ec9b4610ff11d258b3.png)

 ![2025-10-29_14-50-55](https://us1.discourse-cdn.com/wix/original/3X/d/8/d87682fca0044a8566108ed50af9f80db14ff46f.png)

---

<div class="post-metadata">

**Author:** ![Yannick\_Bromme](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/yannick_bromme/32/106149_2.png) [@Yannick\_Bromme](https://forum.wixstudio.com/u/Yannick_Bromme)\
**Post date:** [October 30, 2025, 1:02pm UTC](https://forum.wixstudio.com/t/events-are-not-firing-in-events-js-what-can-i-do-to-test-an-event-to-be-sure-my-events-js-is-working/74624/3 "2025-10-30T13:02:28Z")

</div>

Hello Rob, thanks for your reply. Yes, the frontend code works for me as well and I get the same results that you get. But there is no console log of the backed coming from events.js for the event that should be firing. In this case inserting something into a cms. And this is my problem.

---

<div class="post-metadata">

**Author:** ![Rob](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/rob/32/84134_2.png) [@Rob](https://forum.wixstudio.com/u/Rob)\
**Post date:** [October 30, 2025, 3:43pm UTC](https://forum.wixstudio.com/t/events-are-not-firing-in-events-js-what-can-i-do-to-test-an-event-to-be-sure-my-events-js-is-working/74624/4 "2025-10-30T15:43:07Z")

</div>

Any ideas @thomasj? I didn’t see anything in the backend with the code above either but I’ve not really messed with [Events](https://dev.wix.com/docs/build-apps/develop-your-app/api-integrations/events-and-webhooks/about-events).

---

<div class="post-metadata">

**Author:** ![Pratham](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/pratham/32/119586_2.png) [@Pratham](https://forum.wixstudio.com/u/Pratham)\
**Post date:** [October 30, 2025, 4:19pm UTC](https://forum.wixstudio.com/t/events-are-not-firing-in-events-js-what-can-i-do-to-test-an-event-to-be-sure-my-events-js-is-working/74624/5 "2025-10-30T16:19:15Z")

</div>

> [@Yannick\_Bromme](#):
>
> somehow the events.js is never called.

> [@Yannick\_Bromme](#):
>
> there is no console log of the backed coming from events.js for the event that should be firing. In this case inserting something into a cms.

**afterInsert** is a data hook, and the code for data hooks needs to be written inside **data.js** and not `events.js`

Make sure you read the documentation carefully and use the correct syntax for your code to work as expected.

> **[Using Data Hooks](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/hooks/using-data-hooks)**
>
> You may want to read About Data Hooks before following these instructions. Note: Data hooks run on the server. This means that any logs your code produces do not appear in the Developer Console in Preview mode. Rather, use the built-in Wix Logs tool...
