I'm trying to debug an Apps Script project, and for the past 2–3 days, the debugger hasn't let me look at variables defined at the scope level.
For example, I was trying to debug this code.
/**
* Deletes all rows in a sheet, excluding header rows. Just calling sheet.deleteRows()
* for a massive range of rows will throw out an error.
* @private
*
* @param {Sheet} sheet
* @param {number = 0} numHeaderRows
* @param {number = 500} deletionSize - The number of rows to delete at a time
*/
function deleteAllNonHeaderRows_(sheet, numHeaderRows = 0, deletionSize = 500) {
const startingNumberOfRows = sheet.getMaxRows();
for (let numRows = startingNumberOfRows; numRows > numHeaderRows; numRows -= deletionSize) {
if (numRows < deletionSize) {
const deletionArgs = [numHeaderRows + 1, sheet.getLastRow() - numHeaderRows]
sheet.deleteRows(...deletionArgs);
} else {
sheet.deleteRows(numRows - deletionSize, deletionSize);
}
}
}
It normally would have been a quick process, but since I couldn't look at the value of the arguments I was trying to pass into sheet.deleteRows()
, it took me a moment to tell that I should have used sheet.getMaxRows()
instead of sheet.getLastRow()
. Using the debugger brings up a menu that lists all the scopes, but trying to expand the block scopes doesn't do anything. After some tinkering, I found that this problem extends to everything implemented as an object, so arrays are included, too. Expanding local scopes works, but if any kind of object is in there, I can't expand it.
I'm not sure what could be causing this problem. I was coding in Edge, but switching to Chrome didn't change anything (likely because they're both Chromium-based). I've also tried disabling all my ad blockers and privacy protectors. Looking up issues other people have had didn't turn up any recent posts, either. Is there anything that can be done? I also keep occasionally getting error messages saying something like "Could not connect to server". But the scripts themselves run fine, whether they're run in the container-bound file or the editor itself.
EDIT:
(as of September 1, 2020)
Original answer:
(as of July 23, 2020)
Using the debugger results in non-responsive UI (reports vary), server responses of 409
, breakpoints hang execution. Star the issue linked to below if you are experiencing similar behavior.
Link to Issue in Google's IssueTracker: "Debug mode not responsive in V8"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With