HomeBlogTexas Ranger

Previous arcticle: TypeScript 4 Ever(ywhere)-Deploy to azure


So far, we created a nodejs app, nodejs modules and deployed them to azure. But how do we manage and operate the app? How can we track down problems?

The good thing: azure web apps are (almost) VMs - Kudu Tools

When you create an azure web app, it will create a VM you can connect to. You can access the so called "Kudu Tools" in two ways:

  • Through the azure portal: Klick on your app and go to Advanced Tools "App - Advanced Tools" This will take you to the Kudu tools page

  • Directly through a link like "https://yourAppName.scm.azurewebsites.net/", which, in our case, is "https://testnodejsazure.scm.azurewebsites.net/"

When you deploy a nodejs app to azure, azure will use IIS as HTTP-server to deliver the app. It automatically configures the iisnode_ module to correctly route the requests.
Within the Kudu tools, one can browse the IIS virtual directories by selecting Debug console => CMD:

"Kudu - Browse Virtual Dirs"

In the lower part of the screen, you see a CMD-shell which we will use to install some tools shortly…

"Kudu - CMD"

Why all that matters: Bad, bad native modules, node-gyp

If you ever had to install NPM modules containing native code (e.g. bufferutils), you sure had fun. Why? Because the npm installer tries to launch node-gyp which will compile files for your target platform. So how the hell does azure know how to do that? Well, two simple "tricks" will do the trick:

  1. Set the correct node-version in the application settings in the azure portal. E.g. 10.14.1.

"App Settings"

  1. Before deploying your app to azure, use the Kudu-command shell to install node.gyp.: npm install -g node-gyp: This will install node-gyp using the version of the node/npm-tools we specified in the previous step.

Error tracking

The easiest way to track errors is to check the log-files through Kudu (browse to directory LogFiles) or through the streaming log services in the azure portal. First, we need to enable logging:

"Turn on logs"


The next article will cover monitoring through azure monitoring and application insights.