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


#1

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.


#2

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.


#3

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.


#4

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?


#5

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.


#6

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.

The log file shows that a event script is triggerd:

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