首页 > 解决方案 > Google Execution API 找不到共享函数

问题描述

我逐步完成了这个示例来创建一个 Google Apps 脚本。我已经从第 3 方 javascript 应用程序连接了 OAuth2 凭据,并尝试通过该应用程序执行我的 google 应用程序脚本。每次我尝试它都会失败

"error": {
"code":3
"message": "ScriptError",
"details":[{
"@type:": "type.googleapis.com/google.apps.script.v1.ExecutionError",
"errorMessage": Script function not found: setData",
"errorType": "ScriptError"}]}}

我已经在这个 App Script 上启用了 Apps Script API,并且可以从我的 Drive 中看到执行失败的日志。我正在通过我创建 Oauth2 凭据的 chrome 扩展程序进行连接

相关函数也被命名为“setData”: function setData(parameters) {

如果我查看 setData 上的执行记录,我看到它正在尝试运行:

[19-01-24 16:33:39:982 PST] Starting execution 
[19-01-24 16:33:39:988 PST] Execution failed: Script function not found: setData [0 seconds total runtime]

具有讽刺意味的是,在模态后面我可以看到函数“setData”坐在那里

请让我知道如何调试它

标签: google-apps-scriptgoogle-apps-script-api

解决方案


好的,问题是当我第一次publish -> deploy as API executable在我的 Google Apps 脚本上选择时,我的函数名称不同。我认为在更改后再次执行该流程,即publish -> deploy as API executable足以更新我在 Apps Script API 上的功能。事实上,我不得不在publish -> deploy as API executable. 完成此操作后,我的 chrome 扩展程序成功连接。


推荐阅读