使用Google Workspace替代runtime配置manifest时添加enableHttpEndpoints报错
Google Workspace Add-on manifest报错修复
报错原因
enableHttpEndpoints 是App Script项目级的顶层配置字段,不属于addOns节点的可配置子项,错误嵌套在addOns内部时,manifest校验流程会将其识别为非法未知字段,直接阻断保存操作。
修复操作
- 将
enableHttpEndpoints: true从addOns节点内移出,放置到与addOns、runtimeVersion、oauthScopes同级的manifest顶层位置 - 调整后即可通过字段校验,支持外部HTTP云函数作为Add-on的触发回调地址
调整后的正确Manifest配置
{ "timeZone": "America/New_York", "dependencies": {}, "exceptionLogging": "STACKDRIVER", "oauthScopes": [ "https://www.googleapis.com/auth/gmail.addons.execute", "https://www.googleapis.com/auth/gmail.metadata" ], "runtimeVersion": "V8", "enableHttpEndpoints": true, "addOns": { "common": { "name": "My HTTP Add-on", "logoUrl": "https://fonts.gstatic.com/s/i/googlematerialicons/markunread_mailbox/v6/black-24dp/1x/gm_markunread_mailbox_black_24dp.png", "homepageTrigger": { "runFunction": "https://us-central1-test-http-runtime.cloudfunctions.net/HttpAddOn/exampleWidgets" } }, "gmail": { "contextualTriggers": [ { "unconditional": {}, "onTriggerFunction": "https://us-central1-test-http-runtime.cloudfunctions.net/GmailExample/simpleMessageInfo" } ] } } }
运行注意事项
- 开启
enableHttpEndpoints后,所有配置的回调地址必须为公网可访问的HTTPS端点,否则触发器无法正常完成调用 - 需核对当前配置的
oauthScopes是否覆盖对应云函数的鉴权要求,避免运行时出现权限不足报错
内容的提问来源于stack exchange,提问作者Abhishek Kumar
相关产品推荐
相关产品推荐

