# Server-side events scripts will work only from API- Docs

**URL:** <https://community.dreamfactory.com/t/server-side-events-scripts-will-work-only-from-api-docs/1865>\
**Category:** Server-Side Scripting\
**Created:** [December 1, 2015, 7:48am UTC](https://community.dreamfactory.com/t/server-side-events-scripts-will-work-only-from-api-docs/1865 "2015-12-01T07:48:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![BeLaBu](https://avatars.discourse-cdn.com/v4/letter/b/a9a28c/32.png) [@BeLaBu](https://community.dreamfactory.com/u/BeLaBu)\
**Post date:** [December 1, 2015, 7:48am UTC](https://community.dreamfactory.com/t/server-side-events-scripts-will-work-only-from-api-docs/1865/1 "2015-12-01T07:48:33Z")

</div>

Hi,  
I have a test system with which I’ve been testing the server scripts. Now I’ve found that Post / patch / … event-scripts on the database stopped working for some reason. But if I do the same post / patch / … from the console (API Docs) and not from my application, the events are triggered. I use the same user in both cases.  
In the log I see no exceptions. It looks as if the server not notice the change in the database. I already checked the users scripts authorization. Could it be because I have cloned the VM? If so, what can I check?

DF Service Platform Version: 1.9.4.

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![rdubya152](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/rdubya152/32/492_2.png) [@rdubya152](https://community.dreamfactory.com/u/rdubya152)\
**Post date:** [December 1, 2015, 2:30pm UTC](https://community.dreamfactory.com/t/server-side-events-scripts-will-work-only-from-api-docs/1865/2 "2015-12-01T14:30:11Z")

</div>

BeLaBu,

Are you including the API key in your headers? Make sure you include the API key in the header “X-DreamFactory-Api-Key” and also double check to ensure permissions are properly assigned.

“http://{yourinstance}.com/test\_rest” is a great way to test to make sure that a) roles are properly assigned and b) that the API key is infact working. You’ll have to create a new app within your platform in order to receive an API key.

 ![](https://canada1.discourse-cdn.com/flex035/uploads/dreamfactory/original/1X/ce887e1d11650b6585e2187ea3b1ce4ae9dc18e8.PNG)

---

<div class="post-metadata">

**Author:** ![BeLaBu](https://avatars.discourse-cdn.com/v4/letter/b/a9a28c/32.png) [@BeLaBu](https://community.dreamfactory.com/u/BeLaBu)\
**Post date:** [December 1, 2015, 3:03pm UTC](https://community.dreamfactory.com/t/server-side-events-scripts-will-work-only-from-api-docs/1865/3 "2015-12-01T15:03:49Z")

</div>

Hi rdubya152,

Thank you for your answer. I am sure that the points mentioned are correct. I can add or modify records in the Dream Factory database. But the server side event-script will not trigger.

---

<div class="post-metadata">

**Author:** ![rdubya152](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/rdubya152/32/492_2.png) [@rdubya152](https://community.dreamfactory.com/u/rdubya152)\
**Post date:** [December 1, 2015, 3:29pm UTC](https://community.dreamfactory.com/t/server-side-events-scripts-will-work-only-from-api-docs/1865/4 "2015-12-01T15:29:12Z")

</div>

Oh hm, I see… I’ve occasionally had some trouble with server-side scripts activating, most recently on the file system service (doesn’t seem to fire at all… still trouble shooting that).

Did you set up your role service levels to have access to those scripts?

 ![](https://canada1.discourse-cdn.com/flex035/uploads/dreamfactory/original/1X/f30f1ac76163d346f2ae83d3125647f85ba39676.PNG)

---

<div class="post-metadata">

**Author:** ![BeLaBu](https://avatars.discourse-cdn.com/v4/letter/b/a9a28c/32.png) [@BeLaBu](https://community.dreamfactory.com/u/BeLaBu)\
**Post date:** [December 2, 2015, 10:18am UTC](https://community.dreamfactory.com/t/server-side-events-scripts-will-work-only-from-api-docs/1865/5 "2015-12-02T10:18:14Z")

</div>

The role service levels are set to have access to those scripts. In fact the configuration worked some days ago. I recived every event from any database change. The only change I made was moving my virtual machine with the Dreamfactory Stack to a new location. Since then the event script execution seems to be broken.

 ![](https://canada1.discourse-cdn.com/flex035/uploads/dreamfactory/original/1X/daef329f7603edc8dcd1311bb8563ed14d96f986.png)

---

<div class="post-metadata">

**Author:** ![BeLaBu](https://avatars.discourse-cdn.com/v4/letter/b/a9a28c/32.png) [@BeLaBu](https://community.dreamfactory.com/u/BeLaBu)\
**Post date:** [December 2, 2015, 2:52pm UTC](https://community.dreamfactory.com/t/server-side-events-scripts-will-work-only-from-api-docs/1865/6 "2015-12-02T14:52:09Z")

</div>

Found the scripts config in htdocs\config\common.config.php. To me, everything looks correct. I enabled log\_events and log\_all\_events for more informations from the log file.

 ![](https://canada1.discourse-cdn.com/flex035/uploads/dreamfactory/original/1X/78bbd38a1b303fd31183af135cb4b910ae428099.png)

The log file shows that a event script is triggerd:

 ![](https://canada1.discourse-cdn.com/flex035/uploads/dreamfactory/original/1X/758349b1dc56141e88a7d8c2678567a692fecdc1.png)

None of the events have been dispatched to a handler. The code inside the event-script is nevertheless not executed.  
😞
