We will soon be updating the Javascript engine in the Cloud Elements Production environments from Node version 6 to version 8. This update will coincide with upcoming usage limits and will have some minor changes to the way that libraries are accessed. One example is the "lodash" library. With the legacy Javascript engine running Node v6, you could use a syntax like this:
//Will be undefined in new JS engine
const find = require('lodash/find');
In our new Javascript engine, this will be undefined because of new security restrictions put into place. Instead, you must use a syntax like any of the following:
//Will work in new JS engine
const _ = require('lodash');
const find = require('lodash').find;
const {find} = require('lodash');
This is because all the libraries in the new engine have been whitelisted after being throughly tested and vetted for security vulnerabilities. In this case, only the "lodash" library is on the whitelist and "lodash/find" is interpreted as unknown and illegal to reference.
The new engine running on Node v8, along with our new usage limits, has already been released to our Staging environment. It is recommended that you review and test all custom JS in Staging for potential issues before the updated engine is released to Production.