Anyone familiar with the common reasons for this t...
# suitescript
j
Anyone familiar with the common reasons for this type of error
com.netsuite.suitescript.scriptobject.ScriptNullObjectAdapter@3dee0079
? It’s happening on a
summarize()
stage of a M/R
j
I doubt this'll be helpful but it looks like a segfault. I'd check references where possible. maybe check with
Copy code
my?.object?.keys?.and?.stuff
if you're using a custom object
a
Any chance you are returning a Summary Search in your getInputData or a search raw object to the map stage without using .getValue over the results?
e
We saw this a bunch around 6 or so months ago, but not since. We were never able to identify a common cause; we had to submit Support tickets and it would magically disappear after working with them for a while. I wish I had more helpful info 😕
👀 1
j
everything seems to be fine if I only run my MR on a smaller set of data
so the MR itself works
a
Are you using getValue in the getInputData?
j
Yes, my getInputData() runs a saved search (not summary) and dumps the results into an array which is returned.
a
When searches are very very very big, I found this error, if you return the search raw object without using getValue you may get away with it.
j
Hm. Because who’d wanna use MR for big data sets, right?
lol
I’m dumping definitions of all our saved searches into txt files in file cabinet, for posterity
and then dragging into Bitbucket & Webstorm
for searchy goodness
we have kinda a lot of SSs
e
Are you paging through them all in
getInputData
?
e
maybe paste your summarize code?
j
Copy code
function summarize(context) {

		log.debug({title: 'summarize()', details: 'start'});

		md_logging.i3Log('EXPORT SAVED SEARCHES', 'summarize() start', 99, null, null, true);

        // Report errors.
		context.reduceSummary.errors.iterator().each(function(key, value) {

			log.debug({title: 'Error in REDUCE stage on key ' + key, details: JSON.parse(value).message});

		});

		let csv = 'ID,Internal ID,Title,Record Type,File ID,File Title' + "\n";

    	context.output.iterator().each(function(key, value) {

    		value = JSON.parse(value);

			log.debug({title: 'summarize()', details: 'iterator adding row'});

			md_logging.i3Log('EXPORT SAVED SEARCHES', 'summarize() iterator adding row', 99, null, null, true);

    		csv += value.id + ',"' + value.internalid + '",' + value.title + ',' + value.record_type_name + ',' + value.file_id + ',' + value.file_title + "\n";

            return true;

        });

        // Make the CSV file.
        let filename = 'saved_search_export_report_' + md_formatting.filetime() + '.csv';

		let csv_file = file.create({
			name: filename,
			fileType: file.Type.CSV,
			contents: csv
		});

		let subject = 'Map/Reduce: Export Saved Searches';

		email.send({
			author: NETSUITE_NOTIFICATIONS,
			recipients: [12227],
			subject: subject,
			body: 'Please see attached<br/><br/>',
			attachments: [csv_file]
		});

    }
I split my data set up into two chunks and did it that way, no issues. So I have the data I need. Just annoying.
a
@jen This is documented tho, as per NetSuite best practices with MR, you should pass the raw data object to map, which I think is wrong from a software design perspective but they do recommend that. No big fan of SuiteAnswers or NetSuite coding best practices to be honest.
Im mentioning this because if you contact support they will point you to that article and that is the end.
j
Yeah
Bit annoying…. in many cases, the object I need to return to map() is not something that can be generated via a single search call.