Unable to find whether the script is being executed or not?


#1

HI,

I have created a post process script in v8js. But the script is not being executed.

Here is the script I have written:

print(“Starting FirstTable post process”);
var_dump(event.response); // outputs to file in storage/log of dreamfactory install directory
var lodash = require(“lodash.min.js”);
var options = {
“CURLOPT_HTTPHEADER”: [“Content-type: application/json”, “kf-api-key: 1234567”]
};
print(“Starting payload process”);
if (event.request.payload.resource) {

lodash._.each (event.request.payload.resource, function( record ) {
print("saving user to klipfolio");
result = platform.api.post("https://app.klipfolio.com/api/1/users", {"first_name":record.Column1,"last_name":record.Column1,"email":record.email}, options);
   
});

print(“Ending payload process”);
}

I have added print message at every step.But nothing is being displayed in the dreamfactory log. But I see following log messages:

[2016-03-15 17:37:02] local.DEBUG: Resource event: srdb._table.{table_name}.post.pre_process  [2016-03-15 17:37:02] local.DEBUG: Resource event: srdb._table.FirstTable.post.pre_process  [2016-03-15 17:37:02] local.DEBUG: Resource event: srdb._table.FirstTable.post.post_process  [2016-03-15 17:37:02] local.DEBUG: Resource event: srdb._table.{table_name}.post.post_process  

I am clueless on where the mistake is. Please help.

Best Regards
Krishna G


#2

For V8js scripting use var_dump() not print(). For Node.js scripting use console.log().


#3

Hi,

Thank you for the suggestion. I used var_dump as well. The log is not capturing any of these messages. I am always getting the message as follows in the log:

[2016-03-16 03:43:09] local.DEBUG: Resource event: srdb._table.FirstTable.post.post_process
Even adding var_dump(“Starting”) step in the post or pre process of processing event, none of these messages are being displayed.

Please suggest.I a trying to do this since for 1 week.

Best Regards
Krishna G


#4

Any other suggestions please. I am kind of stopped here.


#5

Try a single line script like this:

var_dump("Hello");

If that doesn’t work perhaps V8 is not running properly. What OS and DreamFactory version are you on?


#6

I am using bitnami DreamFactory 2.1.0-4 in LInux machine.

I have verified that v8js is working fine in bitnami with the help of bitnami support team.

The simple message suggested by you also not working. Please suggest any other options.

Thanks
Krishna G


#7

Check the log file for errors. In your Bitnami installation directory it’ll be in apps/dreamfactory/htdocs/storage/logs. In your htdocs/.env file you can also set APP_DEBUG=true. Make sure you don’t have any other scripts that are failing. You can temporarily deactivate all the other scripts to help debug.


#8

Hi,

Thank you for the suggestion. I have tried this. But the log is not showing any thing additional about those print messages. Any other thoughts please?

Thanks
Krishna