JavaScript changes and upgrades

Good news!

The xMatters Integration Builder has been upgraded to use JDK 11 - meaning integration designers and scripting aficionados have access to a better, faster, stronger scripting engine.

The bad news is that some custom integration scripts may not be fully JavaScript compliant and may cause some issues or error messages.

Why are we doing this?

We're always looking to upgrade our technologies to deliver the best possible features and functionality, including security updates, performance enhancements, and compatibility improvements. (Just as a quick example, this change lets us support modern JavaScript features like arrow functions and default parameters.)

Switching to JDK 11 (and the AdoptOpenJDK suite) can help provide all these things, and we've scheduled to complete the upgrade on Tuesday, September 17.

What's changed?

Among other things, one of the big differences between JDK 8 (the old version) and JDK 11 (the version we're moving to) is the deprecation of support for the Nashorn JavaScript Engine. Nashorn had something of a quirk in that it accepted some Java functions - meaning that it would accept scripts that were not pure JavaScript, and thus not technically valid.

One other note: JDK version 8 required ECMAScript 5.1 compliance, whereas JDK version 11 requires ECMAScript 6+. What this means is that if you're running an integration on the cloud, your scripts must be ECMAScript 6+. If you're running an integration on the xMatters Agent, your ECMAScript 5.1 script is fine, but be aware that work is underway to update the xMatters Agents to use JDK 11 as well.

What do you need to do?

While this won't affect the majority of integrations, it does mean that non-compliant scripts may encounter some issues after we've made the switch.

For example, here are some Java String methods that could previously be used in custom integrations, along with the appropriate JavaScript replacement:

Java method JavaScript
equalsIgnoreCase
str1.toLowerCase() === str2.toLowerCase()
equals
str1 === str2
contains
str1.includes(str2)

To help prevent any problems from arising, we've added handling for the above functions - and provided some helpful error messages to the Activity Stream in the Integration Builder to point them out - so leaving them in won't break your integrations.

There are some other things that might not be backwards compatible. For example, the following function (along with its working equivalent) isn't supported in ECMAScript 6+:

Unsupported function JavaScript
for each (var element in array1)
array1.forEach(function(element) (...))

Luckily, it doesn't appear anyone is using this function anyway. For calls such as this, the only solution is to edit the integration code to use the correct JavaScript.

Ultimately, the best prevention is simply to make sure that your integration scripts are fully JavaScript and ECMAScript 6+ compliant - something that the more recent versions of the JDK require anyway.

 

 

Have more questions? Submit a request

4 Comments

  • 0
    Avatar
    Clayton Shoemaker

    Was this announced previously and I just missed it? 2 business days notice is hardly a notice especially for those of us that do need to make changes.

  • 0
    Avatar
    Don Clark

    Hi Clayton

    Our engineers have already added handlers for all of the potential issues that they could identify, so even integration scripts that do have those invalid Java methods will continue to function. As long as your integration scripts are fully JavaScript compliant, you shouldn't have to actually change anything. 

  • 0
    Avatar
    Clayton Shoemaker

    So if we leave the invalid method equalsIgnoreCase as in a inbound integration script for triggering an event, the event will still go through?

  • 0
    Avatar
    Don Clark

    Hi Clayton - yes, that's correct. The Integration Builder logs will flag it to make it easier for you to find (and eventually update) those methods, but the scripts will continue to execute and your events will still go through.

Please sign in to leave a comment.
Powered by Zendesk