Azure ASEv3 and –max-http-header-size: bad variable

A couple of months ago, I helped a customer migrate their Sitecore environments from the v2 App Service Environments (ASEv2) to newly provisioned v3 versions (ASEv3). Microsoft retired ASEv2s at the end of August. In each environment, we had two linux-based app services running the rendering hosts for our Headless SXA site – one for “delivery” and one for “preview”. Even though we deployed the same code artifact to both (the only difference being the endpoint for the layout service), only the delivery rendering host started successfully. The preview rendering host, however:

It wouldn’t start. Digging through the logs, I found the following error:

/opt/startup/startup.sh: 11: export: --max-http-header-size: bad variable

Each app service had a NODE_OPTIONS environment variable defined with the value --max-http-header-size=8000. The delivery rendering host ran smoothly, but the preview rendering host simply wouldn’t start. This occurred in every single environment – Dev, Test, UAT and Prod.

Because the issue only happened on the preview rendering host, we started comparing every single configuration option we could find between the two app services. We eventually found that the only way to get the preview rendering service to start was to remove the NODE_OPTIONS variable from the preview rendering host. However, the --max-http-header-size setting was necessary to avoid another issue that led to adding that environment variable in the first place, so this solution was a non-solution.

Since we knew it HAD to be configuration of the app services – remember, both were running the exact same code artifact – we opened a ticket with Microsoft. As we continued investigating, we noticed a subtle difference in one specific environment variable:

  • The delivery rendering host (which worked) had ApplicationInsightsAgent_EXTENSION_VERSION set to ~3.
  • The preview rendering host (which failed) had the same variable set to ~2.

Now, you might be thinking, What does Application Insights have to do with NODE_OPTIONS?

That’s certainly what I thought. But after changing ApplicationInsightsAgent_EXTENSION_VERSION on the preview host to ~3, everything started working again – even with the original NODE_OPTIONS configuration.

I know this isn’t directly related to Sitecore, but I hope posting our situation helps someone else. Cause google was absolutely no help.

Happy Sitecore trails, my friends!

Leave a comment