Custom service scripting


#1

Hi,

I have tried the Example given in http://wiki.dreamfactory.com/DreamFactory/Tutorials/V8_custom_scripting_service

and I invoked this request through postman Chrome Extension. please find the details below.

Custom Code:

var lodash = require(“lodash.min.js”);

if (event.request.method !== “GET”) {
throw(“Only HTTP GET is allowed on this endpoint.”);
}

var params = event.request.parameters;

// check for required params
var required = [“n1”,“n2”];
lodash._.each( required, function( element ) {
if (!params.hasOwnProperty(element) || !params[element]) {
throw( “Missing '” + element + “’ in params\n” );
}
});

var result = Number(params.n1) + Number(params.n2);
return result;

Requested URL:

http://127.0.0.1:10678/api/v2/add?api_key=91a0c7f374c711b06e1fbb7943b4a4d752c5fb2ec55372fb07ce26ade12be2c6&n1=9&n2=9

I get the following response.
“error”: {
“context”: null,
“message”: “The module “lodash” could not be found in any known locations.”,
“code”: 500,

I checked the Dream Factory logs i found the following.

[2015-11-26 19:13:09] local.DEBUG: Service event: add.get.pre_process

[2015-11-26 19:13:09] local.DEBUG: * no “require()” support in V8 library v3.17.15

Please help me about how to resolve this

Regards,
K R Sreenivas Harshith.


#2

I am also having the same issue!


#3

Hi guys! Did you fix the problem? Having the same here…


#4

V8 scripting was previously not supported in the Windows Bitnami builds.

With the release of DreamFactory 2.0.3, we have been able to add this feature back into the Windows build. To use it, you will have to install this new stack.


#5

Actually I overlooked the original question, didn’t know it was about Windows. I just started a new instance based on Bitnami image and everything works well now.

Many thanks!