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?
Disabling App Script V8 runtime fixed the issue for me when logged with multiple accounts...
I was developing an Add-on on my non-primary Google account so I was facing the error when calling server-side Google App Script functions from HTML Dialogs.
I hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With