VR Integration Error: TypeError: Method "toString" called on incompatible object

charan99
Tera Contributor

I'm hitting a recurring error during our Vulnerability Integration runs and am looking for some guidance on how to properly resolve it.

 

When running our integration, the integration run fails with the following message:

Encountered error running the integration. TypeError: Method "toString" called on incompatible object (org.mozilla.javascript.NativeObject is not an instance of org.mozilla.javascript.BaseFunction).

Log & Stack Trace Details

Checking the system logs (syslog), I can see the exact stack trace where this error gets thrown:

Plaintext
 
Caught error while validating data, integration process VINTPRC0017374 TypeError: Method "toString" called on incompatible object (org.mozilla.javascript.NativeObject is not an instance of org.mozilla.javascript.BaseFunction).
 at sys_script_include.054d5d389f60020034c6b6a0942e70db.script:116
 at sys_script_include.054d5d389f60020034c6b6a0942e70db.script:50
 at sys_script.2e1cd7825333020034c69816a11c081e.script:5 (executeRule)
 at sys_script.2e1cd7825333020034c69816a11c081e.script:7

Code Analysis

The SysID 054d5d389f60020034c6b6a0942e70db points directly to the out-of-the-box (OOTB) Script Include VulnerabilityIntegrationController.

Upon reviewing the internal code in that controller, the failure stems from a call to validate the attachment payload size:

JavaScript
 
this.integrationProcessor.validateAttachmentSize(report, this.integrationProcessGr);

It looks like downstream from this line, JavaScript's .toString() is being invoked on a native Java/Rhino object (NativeObject) that doesn't inherit from BaseFunction, causing the Rhino engine to crash. If I comment this specific line out, the execution bypasses the validation and proceeds, but altering this core OOTB script is obviously not ideal.

Questions for the Community:

  1. Has anyone else encountered this Rhino engine mismatch (NativeObject vs BaseFunction) during attachment size validation in Vulnerability Response?

  2. Is there a known fix, property adjustment, or ServiceNow HI PRB associated with validateAttachmentSize handling third-party payloads?

  3. What is the safest way to address this without leaving core OOTB Script Includes permanently customized/modified?

Thanks in advance for your help and insights!

1 REPLY 1

Tanushree Maiti
Mega Patron

Hi @charan99 

 

Check  toString() is used in which script include on which object.

 

If code is not customized at all ( means you are using OOB), raise a case (Hi Ticket) to your Servicenow Vendor .

 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: