microsoft / ApplicationInsights-node.js

Microsoft Application Insights SDK for Node.js
MIT License
324 stars 141 forks source link

'Generating Deployment Script' step consistently failing during Zip Push Deploy - applicationinsights node module exception #1142

Open FinVamp1 opened 1 year ago

FinVamp1 commented 1 year ago

Cross posting from 'Generating Deployment Script' step consistently failing during Zip Push Deploy - applicationinsights node module exception

Repro steps.

Our project consistently builds on our local dev machine, and even when we attempt to deploy a zip file that was previously deployed successfully (and currently running in the deployed build), this error still reproduces.

We usually use Zip Push Deploy via the Kudu API, but have also attempted using the Kudu UI and encountered the same issue. The issue still reproduces after starting the web app.

The log/error given by the failure.

After the deployment step 'Generating Deployment Script' we get the following error:

2022-07-19T21:39:58.0694341Z : Using the following command to generate deployment script: 'azure site deploymentscript -y --no-dot-deployment -r "D:\local\Temp\zipdeploy\extracted" -o "D:\home\site\deployments\tools" --basic --sitePath "D:\local\Temp\zipdeploy\extracted"'. 2022-07-19T21:40:01.6167091Z : D:\PROGRA2\\nodejs\node_modules\applicationinsights\out\Library\FileSystemHelper.js:43 2022-07-19T21:40:01.6167091Z : exports.statAsync = util_1.promisify(fs.stat); 2022-07-19T21:40:01.6319568Z : ^ 2022-07-19T21:40:01.6475574Z : 2022-07-19T21:40:01.6475574Z : TypeError: util_1.promisify is not a function 2022-07-19T21:40:01.6631792Z : at Object. (D:\PROGRA2\\nodejs\node_modules\applicationinsights\out\Library\FileSystemHelper.js:43:28) 2022-07-19T21:40:01.6631792Z : at Module._compile (module.js:570:32) 2022-07-19T21:40:01.678833Z : at Object.Module._extensions..js (module.js:579:10) 2022-07-19T21:40:01.678833Z : at Module.load (module.js:487:32) 2022-07-19T21:40:01.6944674Z : at tryModuleLoad (module.js:446:12) 2022-07-19T21:40:01.6944674Z : at Function.Module._load (module.js:438:3) 2022-07-19T21:40:01.7100815Z : at Module.require (module.js:497:17) 2022-07-19T21:40:01.7100815Z : at require (internal/module.js:20:19) 2022-07-19T21:40:01.7256807Z : at Object. (D:\PROGRA2\\nodejs\node_modules\applicationinsights\out\Library\InternalAzureLogger.js:48:24) 2022-07-19T21:40:01.7256807Z : at Module._compile (module.js:570:32) 2022-07-19T21:40:01.7569624Z : D:\PROGRA2\\nodejs\node_modules\applicationinsights\out\Library\FileSystemHelper.js:43\r\nexports.statAsync = util_1.promisify(fs.stat);\r\n ^\r\n\r\nTypeError: util_1.promisify is not a function\r\n at Object. (D:\PROGRA2\\nodejs\node_modules\applicationinsights\out\Library\FileSystemHelper.js:43:28)\r\n at Module._compile (module.js:570:32)\r\n at Object.Module._extensions..js (module.js:579:10)\r\n at Module.load (module.js:487:32)\r\n at tryModuleLoad (module.js:446:12)\r\n at Function.Module._load (module.js:438:3)\r\n at Module.require (module.js:497:17)\r\n at require (internal/module.js:20:19)\r\n at Object. (D:\PROGRA2\\nodejs\node_modules\applicationinsights\out\Library\InternalAzureLogger.js:48:24)\r\n at Module._compile (module.js:570:32)\r\nD:\Program Files (x86)\SiteExtensions\Kudu\97.40427.5713\bin\Scripts\starter.cmd "D:\Program Files (x86)\SiteExtensions\Kudu\97.40427.5713\bin\node_modules.bin\kuduscript.cmd" -y --no-dot-deployment -r "D:\local\Temp\zipdeploy\extracted" -o "D:\home\site\deployments\tools" --basic --sitePath "D:\local\Temp\zipdeploy\extracted"

Mention any other details that might be useful.

Kudu Version: 97.40427.5713

FinVamp1 commented 1 year ago

NathanBlaise-MSFT filed the original issue. This is blocking a lot of customers who deploy via ZipDeploy to a site that has this Node Application Insights agent installed.

dougholland commented 4 months ago

I'm encountering this same error within an ASP.NET 8.0 Blazor Web Assembly app that I'm using a GitHub Action to build and deploy. Is there any update on when this will be resolved?

ssnseawolf commented 4 months ago

@dougholland Have you tried removing the app service environment variable XDT_MicrosoftApplicationInsights_NodeJS? It was added automatically in my environment.

This resolved the error for me in a pure ASP.NET8 Blazor Web app. Worth a shot.