简体   繁体   English

GMail Google Apps Script Plugin“Apps Script 返回的值具有附加组件平台无法使用的类型”

[英]GMail Google Apps Script Plugin "The value returned from Apps Script has a type that cannot be used by the add-ons platform"

In the last 24 hours, a previously working GMail plugin I run has started failing.在过去 24 小时内,我运行的一个以前工作的GMail 插件开始失败。

I stripped it all the way down to only trying to get the example from the docs working:我一直将其剥离,只尝试从文档中获取示例:

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();
}

On BUILD (not on button press), the previously working GMail Addon displays the error message:在 BUILD 上(不是按下按钮),以前工作的 GMail Addon 显示错误消息:

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)"
  }
}

Is this a new, known issue?这是一个新的已知问题吗? Does anyone have some troubleshooting steps to share?有没有人有一些故障排除步骤可以分享?

For me the error was was caused by open links not being whitelisted.对我来说,错误是由未将打开的链接列入白名单引起的。 For example, if you have code like this:例如,如果您有这样的代码:

CardService.newOpenLink().setUrl(url)

Then the link returned by 'url' has to be whitelisted in the appscript manifest's openLinkUrlPrefixes list, like so:然后 'url' 返回的链接必须在 appscript 清单的openLinkUrlPrefixes列表中列入白名单,如下所示:

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

This problem is caused by Google's silent upgrading of Apps Script to the V8 Runtime.此问题是由 Google 将 Apps Script 静默升级到 V8 Runtime 引起的。 To downgrade from this runtime to the old runtime (Rhino), perform this set of actions:要从此运行时降级到旧运行时 (Rhino),请执行以下操作:

Run -> Disable New Apps Script runtime powered by Chrome V8运行->禁用由 Chrome V8 提供支持的新应用脚本运行时

A related issue can be found here .可以在此处找到相关问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM