I wrote a google scripts editor addon, and published it to the google marketplace with private visibility (it is only visible to the users in my organization). I tested the addon with all types of permissions (installed for current user, enabled in current document, installed and enabled) in the script editor, and everything works as intended. However, after publishing the addon to the marketplace and installing it in a test spreadsheet, I keep getting this error: We're sorry, a server error occurred while reading from storage. Error code PERMISSION_DENIED.
from the onOpen
function.
I am setting these oauth scopes explicitly:
"oauthScopes": [
"https://www.googleapis.com/auth/script.container.ui",
"https://www.googleapis.com/auth/spreadsheets.currentonly",
"https://www.googleapis.com/auth/script.scriptapp",
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/userinfo.profile"
]
And here is my onOpen
trigger:
function onOpen(e: AppsScriptEvent) {
if (e && e.authMode !== ScriptApp.AuthMode.NONE) {
const ui = SpreadsheetApp.getUi();
const menu = ui.createAddonMenu();
menu.addItem("Add New Offering", "addNewOffering");
menu.addSeparator();
menu.addSubMenu(
ui
.createMenu("Settings")
.addItem("Dashboard Name", "changeDashboardName")
.addItem("Dashboard Start Cell", "changeDashboardStartCell")
);
menu.addToUi();
}
}
What other type of permission am I missing here?
I ran into the same problem and it seems to be related with being signed into multiple google accounts on Chrome.
When running the script from Laptop 2 I get an error:
We're sorry, a server error occurred while reading from storage. Error code PERMISSION_DENIED.`
I tried the script on Laptop 1 and everything was working fine. Next I opened an Incognito windows on Laptop 2 and signed into my single account and everything works.