JSS applications fail to render pages after Azure update


Description

JavaScript Services (JSS) websites hosted in Azure Web Apps might fail to render pages when the WEBSITE_NODE_DEFAULT_VERSION application setting points to an unsupported Node.js version. For example, WEBSITE_NODE_DEFAULT_VERSION is set to unsupported 14.15.1 (or another one) instead of supported 14.16.0. The list of supported runtimes can be changed after an Azure update.

The list of currently supported runtimes can be checked using these steps:

  1. Open the Kudu Service page.
  2. Click on the link labeled Runtime versions in the REST API section. This will open a JSON file listing currently available runtimes.
  3. Look for available supported versions.

The following message appears after an Azure update:

 

Around xx/xx/xxx X:XX:XX PM (UTC), on Instance [Your instance],  your application was recycled as the Azure scale unit was undergoing an upgrade. There are periodic updates made by Microsoft to the underlying Azure platform to improve overall reliability, performance, and security of the platform infrastructure where your application is running on. Most of these updates are performed without any impact upon your web app. To reduce the impact of such events on your application, consider deploying your application to multiple regions and use Azure Traffic Manager to distribute the load across regions.

 

 

The symptoms of experiencing this issue may be the following errors appearing when rendering a page:

Value cannot be null.
Parameter name: address
System.ArgumentNullException 
 at Sitecore.JavaScriptServices.ViewEngine.NodeServices.HostingModels.Http.HttpNodeInstance.InvokeExport
 at Sitecore.JavaScriptServices.ViewEngine.NodeServices.HostingModels.OutOfProcessNodeInstance.InvokeExport
…

or

Application has thrown an uncaught exception and is terminated:SyntaxError: Unexpected token )
 at Module._compile (module.js:434:25)
 at Object..js (module.js:464:10)

Solution

To resolve the issue proceed as follows:

  1. Log in to the Azure portal and select the Azure Web App that you need to troubleshoot.
  2. Go to "Application settings".
  3. Set the WEBSITE_NODE_DEFAULT_VERSION setting to any supported version, for example:
    WEBSITE_NODE_DEFAULT_VERSION=14.16.0

For more details, refer to Microsoft documentation