I have deployed a spreadsheet bound script as an add-on. It worked when it was container bound. But now, as an add-on, I get a server error when I call DriveApp.getFolderById
function makeMap (){
console.log("start lesmap");
try{var map=DriveApp.getFolderById(DIPmapId); }catch(e){console.log("error map:"+e )}
try{var temp=DriveApp.getFileById(templateId);}catch(e){console.log("error tempfile:"+e) }
}
throws errors (in Dutch but meaning: server error, wait a while and try again):
2020-05-23 12:10:11.310 CEST error map:Exception: Er is helaas een serverfout opgetreden. Wacht enige tijd en probeer het dan nogmaals. 2020-05-23 12:10:11.347 CEST error tempfile:Exception: Er is helaas een serverfout opgetreden. Wacht enige tijd en probeer het dan nogmaals.
In the manifest file:
{
"timeZone": "Europe/Paris",
"dependencies": {
},
"exceptionLogging": "STACKDRIVER",
"oauthScopes": [
"https://www.googleapis.com/auth/spreadsheets",
"https://www.googleapis.com/auth/drive",
"https://www.googleapis.com/auth/script.container.ui"
]
}
In the G Suite Marketplace SDK Configuration OAuth 2.0-scopes
https://www.googleapis.com/auth/userinfo.email
https://www.googleapis.com/auth/userinfo.profile
https://www.googleapis.com/auth/spreadsheets
https://www.googleapis.com/auth/script.container.ui
https://www.googleapis.com/auth/drive
I have it installed and enabled in the spreadsheet. I run the function in the add-on menu in the spreadsheet, so I guess this is in authmode full? I have editor rights on the map and the file in Drive.
What am I missing?
This seems to be a bug. You can click on the star next to the issue number to receive updates and to give more priority to the bug. Even thought the bug mentions App Maker, it's also an issue with recent deployments.
A possible workaround would be enabling the Drive API (even thought DriveApp and Drive API are not the same) in the Google Advanced Services. After a successful run, you can disable the Drive API again.