pages

Wednesday 30 October 2019

Debugging Azure functions locally

Actually the title of this post should be "Debugging your serverless apps locally".
I found a utility while working on Azure functions which helps you debug the function locally(if you have the source code, obviously). It is called ngrok. They have a pretty awesome website and very simple docs.


Steps to proceed are as below.
  1. Make sure your Azure function is up and running in your machine and you are able to hit the breakpoint from your local.
  2. Signup on the ngrok website.
  3. Download the ngrok utility(its an exe file). double click to execute. It opens a command prompt.
  4. Connect to your account. Upon login to ngrok website you will get an auth token which you have to use to connect to your account. command to execute "ngrok authtoken <your_token_here>". This step will create a .yml file in your users directory.
  5. Create a tunnel. Use command "ngrok http 7071". 7071 is the port you want to expose. I used it because its the default port for Azure function apps.
  6. Use the url provided by the ngrok utility to hit the breakpoint on your function from the internet.
I hope this was easy. Please share your thoughts in the comments below.

No comments:

Post a Comment