Search code examples
erp

Netsuite script 2.0 java.lang.StackOverflowError


I have a script that import / create the orders from a sales channel (shopify) via the API. I create a netsuite module that connects to an API that returns the fedex shipping price to decide best 'ship from' location. Everything is fine, but when the script populates the sales order (N / record) fields, it throws this error: "type": "internal error", "code": "UNEXPECTED_ERROR", "details": "java.lang.StackOverflowError", "userEvent": null, "stackTrace": ....

any ideas, what trigger that error? thx


Solution

  • I solved the problem. The error was triggered by "self-referencing". in the created netsuite module, there was a function that returns the object passed in the parameters. the return of this function was put into property of the same object.

    function do_something(_obj){
     ....
     return _obj;
    }
    var obj = {};
    obj.prp = do_something(obj);