A weird run time error in gmail addon - MessageAcc

2019-07-09 20:30发布

问题:

The add on was running finely. At some point of time , this error started showing up only for one user. Other users dont experience this.

function buildAddOn(e) { //Add on trigger function
  var card = CardService.newCardBuilder();
  card.setHeader(CardService.newCardHeader().setTitle('Home'));
  var section = CardService.newCardSection();
  section.addWidget(CardService.newTextParagraph().setText("hello world"));
  return card.build();
}

I do not have a file called Storage, though.

"SyntaxError: Unexpected token: u [line: 60, function: , file: Storage]"

Update This has something to do with this

 GmailApp.setCurrentMessageAccessToken(e.messageMetadata.accessToken)

Update 2: Gmail UI object e is undefined

This is not supposed to be undefined. This is an object that is provided by the Gmail UI.

console.log(e) //undefined

Update 3 The same addon runs perfectly for other users.

回答1:

Empty cache and Hard reload browser this error will disappear (But keep in mind that it's not proper way to skip error for user end)