if you use MR script to create / save files, test ...
# releases
s
if you use MR script to create / save files, test it on RP. there is a defect for version 2.x or 2.1
a
@Selcuk Dogru Could you share what you're seeing?
s
hi Ashwin, it is already fixed yesterday.
Hi Ashwin, we are now experiencing the problem on Production
it was OK in the morning for over 200 tests. Now 6 over 23 tests failed
Copy code
{
  "type": "error.SuiteScriptError",
  "name": "SyntaxError",
  "message": "Invalid quantifier ?",
  "stack": [
    "createError(N/error)"
  ],
  "cause": {
    "message": "Invalid quantifier ?",
    "fileName": "/SuiteScripts/Generic Customizations/mr_file_test.js",
    "lineNumber": 30,
    "name": "SyntaxError",
    "stack": "\tat /SuiteScripts/Generic Customizations/mr_file_test.js:30 (reduce)\n\tat INVOCATION_WRAPPER$sys:75\n\tat INVOCATION_WRAPPER$sys:23\n\tat INVOCATION_WRAPPER$sys:111\n\tat INVOCATION_WRAPPER$sys:4\n",
    "rhinoException": "org.mozilla.javascript.EcmaError: SyntaxError: Invalid quantifier ? (/SuiteScripts/Generic Customizations/mr_file_test.js#30)"
  },
  "id": "",
  "notifyOff": false,
  "userFacing": true
}
My script code is
/**
* @NApiVersion 2.x
* @NModuleScope Public
* @NScriptType MapReduceScript
*
* @author Selcuk Dogru
*
* @module N/file
* @module N/task
*
* @description
*/
define(['N/file', 'N/task'],
function (file, task) {
function getInputData(inputContext) {
return [1];
}
function reduce(reduceContext) {
var fileObj = file.create({
name: 'cs_test1.txt',
fileType: file.Type.PLAINTEXT,
contents: 'whatever',
folder: 1836989
});
var fileId = fileObj.save();
file.delete({
id: fileId
});
}
function summarize(summary) {
summary.reduceSummary.errors.iterator().each(function (key, error) {
log.error('Reduce Error for key: ' + key, error);
return true;
});
var sTask = task.create({
taskType: task.TaskType.MAP_REDUCE,
scriptId: 'customscript1888',
deploymentId: 'customdeploy1'
});
sTask.submit();
}
return {
config: {
retryCount: 2,
exitOnError: false
},
getInputData: getInputData,
reduce: reduce,
summarize: summarize
};
});
a
Do you get this error when you save this file in FC?
s
yes
For 2.0 and 2.x it happens during save
if I change script version to 2.1, it happens during file.create
another finding I've is, doesn't matter how many file operations you've in the script, it fails for all or none during a single run
can it be based on the load on the server, libraries or operation routed to different server hence the behavior?