Has anyone else run into what seems like a bug wit...
# suitescript
m
Has anyone else run into what seems like a bug with NetSuite handling circular dependencies? I am getting the infamous
There was a problem when uploading the file. Details: SuiteScript 2.1 entry point scripts must implement one script type function..
when upload I a Map/Reduce via Webstorm. I believe I've isolated the issue to the dependencies. It imports two module libraries -
utils.js
and
constants.js
.
utils.js
also depends on
constants.js
. If I try add both to the MapReduce I get the error, but if I only add either one of the two, or remove
constants.js
as a dependency from
utils.js
it uploads fine. Also noteworthy is I have a suitelet that is importing both libraries without issue. Additionally SDF deploy works fine, and I am only encountering the issue if I upload the file individually.
s
I've seen weird issues at times if you have comments before the @Nxxx comment directives
m
This is my entire test script. It uploads fine until I add the dependencies
Copy code
/**
 * @NApiVersion 2.1
 * @NScriptType MapReduceScript
 */

define([], () => ({
  getInputData() {
    return ["hello world"];
  },

  map(context) {
    log.debug(context.value);
  },
}));
c
What i've had to do for this in the past is upload the script thats creating the actual record with a basic entry point and then create the deployment. Then just upload all of your pieces after that and it should be fine.
It was something w/ the preprocessor and including things but I never dug around in it enough to get to the actual issue
m
I can upload the script and update via SDF but as soon as I add the dependencies I need, I can no longer update that file
Ok so I just noticed that in one of the files I was importing the dependency as
filename.js
and in the others it was just
filename
and this appears to throw NetSuite off. Removing the
.js
has resolved the issue. headbanging parrot
s
good to know