很抱歉,从存储读取时发生服务器错误.错误代码 PERMISSION_DENIED [英] We're sorry, a server error occurred while reading from storage. Error code PERMISSION_DENIED

查看:25
本文介绍了很抱歉,从存储读取时发生服务器错误.错误代码 PERMISSION_DENIED的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个 google 脚本编辑器插件,并以私人可见性将其发布到 google 市场(它仅对我组织中的用户可见).我在脚本编辑器中测试了具有所有类型权限(为当前用户安装、在当前文档中启用、已安装和启用)的插件,一切都按预期工作.但是,在将插件发布到市场并将其安装在测试电子表格中后,我不断收到此错误:很抱歉,从存储读取时发生服务器错误.错误代码 PERMISSION_DENIED. 来自 onOpen 函数.

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.

我正在明确设置这些 oauth 范围:

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"
  ]

这是我的 onOpen 触发器:

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?

推荐答案

我遇到了同样的问题,似乎与在 Chrome 上登录多个谷歌帐户有关.

I ran into the same problem and it seems to be related with being signed into multiple google accounts on Chrome.

  • 笔记本电脑 1:昨晚我在笔记本电脑上编写 Google App 脚本仅在 Chrome 上使用一个 Google 帐户.
  • 笔记本电脑 2:今天我正在尝试使用我的另一台笔记本电脑更新我的 Google App 脚本已登录多个 Google 帐户.

从笔记本电脑 2 运行脚本时出现错误:

When running the script from Laptop 2 I get an error:

很抱歉,从存储读取时发生服务器错误.错误代码 PERMISSION_DENIED.

我在笔记本电脑 1 上尝试了该脚本,一切正常.接下来,我在 Laptop 2 上打开了一个隐身窗口并登录了我的单一帐户,一切正常.

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.

这篇关于很抱歉,从存储读取时发生服务器错误.错误代码 PERMISSION_DENIED的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆