How to debug a web app deployed using Google Apps Script

A guide to test doGet and doPost functions, instead of deploying them over and again when any changes are made to the apps script.

How to debug a web app deployed using Google Apps Script
How to debug a web app deployed using Google Apps Script
a simpler way to test the changes that are made in your web app, instead of deploying it 100s of times.

so, i stumbled upon this issue while configuring a webhook that was supposed to accept get request via a query string format but there were also some or the other parameters that i misconfigured in every iteration. and, the thing with apps script is that, every time you modify your script that is supposed to change the behavior of the web app, you are required to re-deploy it once again for it to take affect and there's no programatic way to do so using the browser-based apps script editor. you can however do so using clasp but that's explained in a ton of other videos that you could find online.

any how, what this led to was that I ended up deploying my web app for over a 100 times, simply to test and re-test what the query parameters were, their format, whether or not they were numbers or text etc. and obviously, this was frustrating.

instead of testing the functions within the script by triggering the actual webhook, we could rather create a separate function that hosts the variables and then invokes the doGet or doPost function (based on whatever the scenario is).

that led me to do some digging and i found this documentation that clearly laid out all the parameters and their format that we could expect when using a doGet or a doPost request. let me show you how we could use these with the built-in apps script logger to test a get request -

how to debug a web app deployed using google apps script