"this.proxy is not a function" problem

Hi,

We’re trying to create a NodeJS custom service in our DreamFactory v2.2.0 server (df-core v0.3.1) with NodeJS v6.6.0 installed, but we get the folowing error every time we try to call it:

{
  "error": {
    "context": null,
    "message": "this.proxy is not a function",
    "code": 500,
    "trace": [
      "0 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Components/RestHandler.php(173): DreamFactory\\Core\\Scripting\\Services\\Script->processRequest()",
      "1 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Services/BaseRestService.php(74): DreamFactory\\Core\\Components\\RestHandler->handleRequest(Object(DreamFactory\\Core\\Utility\\ServiceRequest), NULL)",
      "2 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(17036): DreamFactory\\Core\\Services\\BaseRestService->handleRequest(Object(DreamFactory\\Core\\Utility\\ServiceRequest), NULL)",
      "3 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(17008): DreamFactory\\Http\\Controllers\\RestController->handleService('v2', 'smsgw3', NULL)",
      "4 [internal function]: DreamFactory\\Http\\Controllers\\RestController->handlePOST('v2', 'smsgw3')",
      "5 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9093): call_user_func_array(Array, Array)",
      "6 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9155): Illuminate\\Routing\\Controller->callAction('handlePOST', Array)",
      "7 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9135): Illuminate\\Routing\\ControllerDispatcher->call(Object(DreamFactory\\Http\\Controllers\\RestController), Object(Illuminate\\Routing\\Route), 'handlePOST')",
      "8 [internal function]: Illuminate\\Routing\\ControllerDispatcher->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "9 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "10 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(17209): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "11 [internal function]: DreamFactory\\Http\\Middleware\\AccessCheck->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
      "12 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9627): call_user_func_array(Array, Array)",
      "13 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
      "14 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "15 [internal function]: Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "16 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9612): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "17 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9136): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))",
      "18 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9123): Illuminate\\Routing\\ControllerDispatcher->callWithinStack(Object(DreamFactory\\Http\\Controllers\\RestController), Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request), 'handlePOST')",
      "19 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(8191): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request), 'DreamFactory\\\\Ht...', 'handlePOST')",
      "20 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(8178): Illuminate\\Routing\\Route->runController(Object(Illuminate\\Http\\Request))",
      "21 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(7892): Illuminate\\Routing\\Route->run(Object(Illuminate\\Http\\Request))",
      "22 [internal function]: Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "23 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "24 [internal function]: Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "25 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9612): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "26 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(7893): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))",
      "27 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(7884): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))",
      "28 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(7874): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))",
      "29 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(2416): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))",
      "30 [internal function]: Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))",
      "31 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "32 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/app/Http/Middleware/AuthCheck.php(178): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "33 [internal function]: DreamFactory\\Http\\Middleware\\AuthCheck->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
      "34 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9627): call_user_func_array(Array, Array)",
      "35 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
      "36 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "37 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/vendor/barryvdh/laravel-cors/src/HandleCors.php(34): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "38 [internal function]: Barryvdh\\Cors\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
      "39 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9627): call_user_func_array(Array, Array)",
      "40 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
      "41 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "42 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(17306): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "43 [internal function]: DreamFactory\\Http\\Middleware\\FirstUserCheck->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
      "44 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9627): call_user_func_array(Array, Array)",
      "45 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
      "46 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "47 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(13076): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "48 [internal function]: Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
      "49 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9627): call_user_func_array(Array, Array)",
      "50 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
      "51 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "52 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(11622): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "53 [internal function]: Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
      "54 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9627): call_user_func_array(Array, Array)",
      "55 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
      "56 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "57 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(12815): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "58 [internal function]: Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
      "59 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9627): call_user_func_array(Array, Array)",
      "60 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
      "61 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "62 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(12752): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "63 [internal function]: Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
      "64 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9627): call_user_func_array(Array, Array)",
      "65 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
      "66 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "67 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(3271): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "68 [internal function]: Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
      "69 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9627): call_user_func_array(Array, Array)",
      "70 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
      "71 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "72 [internal function]: Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "73 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9612): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "74 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(2363): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))",
      "75 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(2347): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))",
      "76 /home/ubuntu/dreamfactory-2.2.0-0/apps/dreamfactory/htdocs/public/index.php(53): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))",
      "77 {main}"
    ]
  }
}

It’s strange because we managed to create services and use them, but at some point this problem appeared and it happens for any new NodeJS service we create.

Any clue?

Thanks!

It seems that it was a problem with a “require()”, which was used like “new require(‘lib’)()”.

Anyhow it’s strange because after removing it the problem persisted for a while. I guess the script was cached or similar.