Hello All,
i have Dreamfactory(V2.1) on centOS 6
“require is not defined” is returned when i try to run custom script with require()
var lodash = require("lodash.min.js");
var params = event.request.parameters;
var required = ["voucher_code","card_id"];
lodash._.each( required, function( element ) {
if (!params.hasOwnProperty(element) || !params[element]) {
throw new Error( "Missing '" + element + "' in params\n" );
}
});
this is my V8js configuration
========V8JS===========
V8 Javascript Engine enabled
V8 Engine Compiled Version 3.32.6
V8 Engine Linked Version 3.32.6
Version 0.4.1
Error trace
{
"error": {
"context": null,
"message": "require is not defined",
"code": 500,
"trace": [
"0 /opt/dreamfactory-2/vendor/dreamfactory/df-core/src/Components/RestHandler.php(177): DreamFactory\\Core\\Services\\Script->processRequest()",
"1 /opt/dreamfactory-2/vendor/dreamfactory/df-core/src/Services/BaseRestService.php(65): DreamFactory\\Core\\Components\\RestHandler->handleRequest(Object(DreamFactory\\Core\\Utility\\ServiceRequest), NULL)",
"2 /opt/dreamfactory-2/vendor/dreamfactory/df-core/src/Utility/ServiceHandler.php(57): DreamFactory\\Core\\Services\\BaseRestService->handleRequest(Object(DreamFactory\\Core\\Utility\\ServiceRequest), NULL)",
]
}
}
Thank you,
Yahya