Debug your Bot with ngrok

Once you have deployed your Bot to Azure, what do you do if you need to debug or diagnose any issues with the Bot code?

If you are using the .NET Bot Builder you can use the Visual Studio remote debugger and attach your local debugger in Visual Studio to the remote process.  Azure supports this but other hosting providers do not, and of course your Bot needs to be .NET and you need to have debugging symbols available. 

What do you do if:

  • you are using Node?
  • or, do not have debugging symbols?
  • or, hosting your Bot application with a provider that doesn’t support the VS Remote Debugger?

Well you are in luck because you can use ngrok to deal with all these constraints. 

Ngrok provides a secure tunnel to your local machine via a publicly accessible endpoint.

In this short video see how you can use it to debug your Bot application locally. ngrok will work with any language/any technology using common transport protocols (like HTTP).

So, to summarise:

  1. Download ngrok from https://ngrok.com/
  2. Extract the zip file to a folder of your choosing.
  3. Open a command prompt in the above folder, and run``` ngrok http 80
  4. Change your client application to point to the ngrok.io endpoint
  5. Test and debug!