Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging client side code from Google Apps Script

I have issues with my client-side code (who doesn't, with any code they write in any language, at one point or another in the development process?) Problem is that I'm writing this code in Google Apps Script, and can't find the js code I am trying to debug/examine for errors. I remember being able to enter a function name, and then click on the returned code to go straight to the code file, and the function in it, but that, for some reason, isn't working here. I try it and this is what I get taken to:

what even is this?!

(I think Caja might have something to do with this...)

I think it's in some VM**** file, but I don't know much about that. How to access that JavaScript code to set some breakpoints?!

like image 459
Mike Warren Avatar asked Oct 02 '17 07:10

Mike Warren


People also ask

How do I debug a Google App Script?

To run the script in debug mode, at the top of the editor click Debug. Before the script runs the line with the breakpoint it pauses and displays a table of debug information. You can use this table to inspect data like the values of parameters and the information stored in objects.

How do I use withSuccessHandler?

withSuccessHandler(function)Sets a callback function to run if the server-side function returns successfully. The server's return value is passed to the function as the first argument, and the user object (if any) is passed as a second argument.

Does Apps Script run on server-side Google server?

It is based on JavaScript 1.6, but also includes some portions of 1.7 and 1.8 and a subset of the ECMAScript 5 API. Apps Script projects run server-side on Google's infrastructure.


1 Answers

From answer to how can I debug client side javascript (in html pages) in google appscripts

Unfortunately, there is no other good way to debug client side web UI other than with console logs. As you noted the JavaScript/DOM is re-written so you can't use standard Chrome debug tools.

Because of the above, consider using the approach suggested by Mogsdad on Did you know? (You can log to a spreadsheet from client JavaScript!): Write debugging logs to a spreadsheet.

like image 136
Rubén Avatar answered Sep 30 '22 13:09

Rubén