ErrorHandler icon indicating copy to clipboard operation
ErrorHandler copied to clipboard

How to contribute/ask about error messages?

Open rubenrivera opened this issue 6 years ago • 0 comments

I found a conversation where Romain and Jean-Remi mentioned this repo while I was researching about an add-on error message, more explicitely about "You do not have permission to call showSidebar at functionName (fileName: lineNumber)". This error occurs on add-ons triggers created by user A from mydomain.com that are activated by actions made by user B from domain otherdomain.com when functionName tries to open a sidebar.

  1. Are this kind of errors something of interest for you?
  2. I didn't tried yet this library but if this error message isn't catched could I ask about it here?

Something like the following should help to reproduce the error message.

function onInstall(event) {
  onOpen(event);
}

function onOpen(event){
  SpreadsheetApp
  .getUi()
  .createAddonMenu()
  .addItem('Add trigger', 'addTrigger')
  .addItem('Remove all triggers', 'removeTriggers')
  .addToUi();
}

function addTrigger(){
  ScriptApp.newTrigger('respondeToSpreadsheetEdit')
  .forSpreadsheet(SpreadsheetApp.getActive())
  .onEdit()
  .create();
  SpreadsheetApp.getUi().alert('Trigger added.');
}

function respondeToSpreadsheetEdit(event){
  var html = '<p>Hello world!</p>';
  var title = 'Sidebar title';
  var userInterface = HtmlService.createHtmlOutput(html)
  .setTitle(title);
  SpreadsheetApp.getUi().showSidebar(userInterface);
}

function removeTriggers(){
  var triggers = ScriptApp.getProjectTriggers();
  triggers.forEach(function(trigger){
    ScriptApp.deleteTrigger(trigger);
  });
  SpreadsheetApp.getUi().alert('All triggers were removed.');

}

Steps to reproduce the error message

  1. Publish the above code as a Google Sheets add-on
  2. User A install the add-on, click on Add-ons > Add-on name > Add trigger
  3. User A shares the spreadsheet with user B
  4. User B edit cell A1
  5. Open the Stackdriver log for the add-on. There you will find something like the following:

You do not have permission to call showSidebar at respondToSpreadsheetEdit(Code:n)

where n is the code line number for SpreadsheetApp.getUi().showSidebar(userInterface);

P.S. Spanish version of the error message

No cuenta con el permiso para llamar a showSidebar at respondeToSpreadsheetEdit(Código:27)


Related issue on the Apps Script Issue Tracker

rubenrivera avatar Jul 08 '18 06:07 rubenrivera