For years, my add-on has been a victim of this bug:
I can reproduce it by logging into two accounts in my browser and trying to run the add-on (Doc Variables) from the second account. Yesterday, I tested other add-ons with the same context, some fail and others didn't.
I found two open-source add-ons that I could look at the code to compare and didn't see anything different in how they implemented their calls.
My function (that throws an error):
var doc;
try {
doc = DocumentApp.getActiveDocument();
} catch (ex) {
throw new Error("Error loading Active Document.");
}
return doc;
Their's (that work fine):
function getSelection() {
var selection = DocumentApp.getActiveDocument().getSelection();
and
try {
doc = DocumentApp.getActiveDocument();
} catch(e) {
return 'ERROR opening active document: ' + e + '\n\n';
}
Has anyone dug into this issue more? Is there a known workaround now?
Thank you for any help,
Jesse