We recently pushed out an update to our JSS project and were greeted with one of those “Well that’s fun, we’ve never seen that error before” moments.

Here’s the entire text of the YSOD, for SEO purposes 😉
[NodeInvocationException: globalThis is not defined
ReferenceError: globalThis is not defined
at react.Component.react.Component.LayoutServiceBase (C:\home\site\wwwroot\dist\[SNIP]\server.bundle.js:76193:63)
at C:\home\site\wwwroot\dist\[SNIP]\server.bundle.js:80869:3
at Object.<anonymous> (C:\home\site\wwwroot\dist\[SNIP]\server.bundle.js:80874:12)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)]
Now, we’re no stranger to random errors. But, this was a weird one in that it was only happening on CM. CD was totally fine, and our JSS Proxy server was totally fine. That’s…unusual. It’s typically the other way around. I googled a bit and either my Google-Fu is rusty, or this isn’t a common issue. So…off to Slack!
Corey Smith (you probably know him as sitecorey) pointed out that globalThis is only supported by Node.js versions 12+. I know our SSR Proxy is running on version 16, but I never thought to check our CM. You wouldn’t typically think to check your node CM Version, but since we’re running in Integrated mode (for Experience Editor Support), it totally matters. I went into my App Service Configuration tab to check on the settings. Lo and behold:

Once I updated that value to read “~16” things were smooth sailing!
