V8 Custom Script + Later.js =?


#1

Hi,

Build a V8js custom service with later.js to have cron as services. However, following snippet throws error 'Array to string conversion'. Any way to validate/troubleshoot if required js file is loaded. Or library issue

The later.min.js file is copied/available at \Bitnami\dreamfactory-2.1.0-4\apps\dreamfactory\htdocs\storage\scripting\

Code Snippet:

var lodash = require("lodash.min.js");
var _later = require("later.min.js");
var sched = later.parse.cron('15 10 ? * *');
var dates = later.schedule(sched).next(5);
var result = {};
result.phase = 'testing';
result._later = _later;
result.sched = sched;
result.dates = dates;
return result;

#2

I’m not really familiar with later.js, but you could use console logging to dump your debug points to the dreamfactory log. Is there a console to debug server side scripts?


#3

@drewpearce thank you for the reply. From dreamfactory.log, found no stack-trace nor from Apache server logs. Any dev docs as how the custom js file in V8js scripts works with DF. Referred http://wiki.dreamfactory.com/DreamFactory/Features/Scripting/V8Js , however not much details on how to load third party lib/js …from source understanding as it used requirejs.