In Visual Studio 2019 Community, create a new Basic Azure Node.js Express 4 Application (TypeScript).
Npm install web3
Add a line 4 after import path = require('path');
var Web3 = require('web3');
Run it locally to ensure that it works (it does)
Publish it to Azure and watch the logs
It should compile and run fine -- just as it did locally in step 4
Actual Results (from Azure log stream)
Thu Apr 02 2020 17:31:57 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated:D:\home\site\wwwroot\node_modules\web3-core-method\src\index.js:285.then(async function (receipt) {^^^^^SyntaxError: missing ) after argument listat Object.exports.runInThisContext (vm.js:76:16)at Module._compile (module.js:542:28)at Object.Module._extensions..js (module.js:579:10)at Module.load (module.js:487:32)at tryModuleLoad (module.js:446:12)at Function.Module._load (module.js:438:3)at Module.require (module.js:497:17)at require (internal/module.js:20:19)at Object. (D:\home\site\wwwroot\node_modules\web3-core\src\extend.js:27:14)at Module._compile (module.js:570:32)Application has thrown an uncaught exception and is terminated:D:\home\site\wwwroot\node_modules\web3-core-method\src\index.js:285.then(async function (receipt) {^^^^^SyntaxError: missing ) after argument listat Object.exports.runInThisContext (vm.js:76:16)at Module._compile (module.js:542:28)at Object.Module._extensions..js (module.js:579:10)at Module.load (module.js:487:32)at tryModuleLoad (module.js:446:12)at Function.Module._load (module.js:438:3)at Module.require (module.js:497:17)at require (internal/module.js:20:19)at Object. (D:\home\site\wwwroot\node_modules\web3-core\src\extend.js:27:14)at Module._compile (module.js:570:32)
I have looked at line 285 in \node_modules\web3-core-method\src\index.js
and it looks fine.
I deleted my package-lock.json and my node_modules directory and npm installed again (not to mention that I did it on both the original project and the small test project).
I'm at a loss here. Any suggestions?
Azure, by default has an abysmally old version of Node -- and you can only upgrade it to 8.9.4 (while node 12.16.1 is the LTS version).
But upgrading by adding the configuration setting WEBSITE_NODE_DEFAULT_VERSION with a value of 8.9.4 will fix the problem.