【问题标题】:GMail Google Apps Script Plugin "The value returned from Apps Script has a type that cannot be used by the add-ons platform"GMail Google Apps 脚本插件“从 Apps 脚本返回的值的类型不能被插件平台使用”
【发布时间】:2020-06-16 11:18:04
【问题描述】:

在过去的 24 小时内,我运行的以前工作的 GMail 插件开始出现故障。

我把它一直剥离到只试图从docs 工作中获取示例:

var action = CardService.newAction().setFunctionName('composeEmailCallback');
CardService.newTextButton()
    .setText('Compose Email')
    .setComposeAction(action, CardService.ComposedEmailType.REPLY_AS_DRAFT);

// ...

function composeEmailCallback() {
  var thread = GmailApp.getThreadById(e.threadId);
  var draft = thread.createDraftReply('This is a reply');
  return CardService.newComposeActionResponseBuilder()
      .setGmailDraft(draft)
      .build();
}

在 BUILD 上(不是按下按钮),以前工作的 GMail 插件会显示错误消息:

The value returned from Apps Script has a type that cannot be used by the add-ons platform. Also make sure to call build on any builder before returning it. Value: values {
  proto_value {
    type_url: "type.googleapis.com/caribou.api.proto.addons.templates.publicapi.ContextualAddOnMarkup.Card"
    value: "...(omitted)"
  }
}

这是一个新的已知问题吗?谁有一些故障排除步骤可以分享?

【问题讨论】:

    标签: google-apps-script gmail google-apps


    【解决方案1】:

    对我来说,错误是由于未将打开的链接列入白名单造成的。例如,如果你有这样的代码:

    CardService.newOpenLink().setUrl(url)
    

    然后是appscript manifest的openLinkUrlPrefixes列表中'url'has to be whitelisted返回的链接,像这样:

    "openLinkUrlPrefixes": [
        "https://*.example.com"
    ]
    

    【讨论】:

      【解决方案2】:

      此问题是由 Google 将 Apps 脚本静默升级到 V8 运行时引起的。要从此运行时降级到旧运行时 (Rhino),请执行以下操作:

      运行 -> 禁用由 Chrome V8 提供支持的新应用程序脚本运行时

      可以在here找到相关问题。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-11-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-10-23
        • 1970-01-01
        • 2021-12-05
        • 1970-01-01
        相关资源
        最近更新 更多