Debugging a Google Apps Script web-application

At work we want to add an e-ink display to each conference room door, and let it show the next appointments happening in there.

To easily access the Google calendars, a colleague decided to write a Google Apps Script that fetches the calendar data and converts it into JSON that the mini computer can use.

When running a script as web application, you do not get any output in the case of errors, which makes it hard to debug.

So instead of doing that, set a breakpoint on the last line of your calculation function (click on its line number). Then select doGet in the toolbar, and press the bug button to start debugging.

The code will run, and you will be able to inspect all the variables (except objects, which is pretty lame) at the breakpoint. If an error occurs, it will also jump to the errorneous line and show you the error message.

Run script as web application Debugging: Breakpoint Debugging: Error display

Written by Christian Weiske.

Comments? Please send an e-mail.