In this change I removed the usage of the APP_ENABLE_CANCELLABLE_PROMISES environment variable from the chromium-render repository, and instead ensured that npm start started service-runner via the server.js stub, which directly sets Bluebird promises to be cancellable:
#!/usr/bin/env node 'use strict'; // Service entry point. Try node server --help for commandline options. const Promise = require('bluebird'); // enable promise cancellation feature. Promise.config({ cancellation: true }); // Start the service by running service-runner, which in turn loads the config // (config.yaml by default, specify other path with -c). It requires the // module(s) specified in the config 'services' section (app.js in this // example). const ServiceRunner = require('service-runner'); new ServiceRunner().start();
This works well locally and on the Beta Cluster.
However, removing the APP_ENABLE_CANCELLABLE_PROMISES setting from the service's Helm chart and deploying resulted in promise cancellation not being enabled and requests failing. This caused a ~20 min PDF rendering outage from approximately 14:52-15:14 UTC on 2020-07-28 while I noticed the error, replaced the environment variable in the Helm chart, and redeployed.
I don't know why we specifically need the environment variable in production, because based on my reading of the Helm chart, the service start command seems to use the same server.js entrypoint as we use locally and in Beta, in which promise cancellation is enabled directly.