未找到Google Apps脚本功能:doGet [英] Google Apps Script function not found: doGet

查看:300
本文介绍了未找到Google Apps脚本功能:doGet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 未找到脚本函数:doGet 

OR

 未找到脚本函数:doPost 

当我GET / POST到我的Google脚本时:

< pre $ 函数doGet(e){返回ContentService.createTextOutput(用户说)}

函数doPost(e){
return HtmlService.createHtmlOutput (
< form action ='http://www.example.com/users/gmail_permission/'method ='post'id ='foo'>+
<输入类型='hidden'name ='gmail'value ='getEmail()'>+
< input type ='hidden'name ='id'value ='e.parameter.user_id'> +
< / form>+
< script> document.getElementById('foo')。submit();< / script>);


函数getEmail(){
return Session.getActiveUser()。getEmail();
}

奇怪的是当我访问Webapp时会出现上述错误我的浏览器上的网址。但是当我使用Hurl.it时,我只是被重定向到Google Drive。但是,当我在google.script.com上测试web应用程序的最新代码时,GET响应正常。



相当迷茫。 ...这是我的脚本:

  https://script.google.com/macros/s/AKfycbz0XGeoEuP4V6W60N7yP-dDiLltPefxmqzhMJurnGzOhPfqA_er/ exec 

以下是GETs

  FROM Hurl.it  -  GET https://accounts.google.com/ServiceLogin?service=wise&followup=https://script.google.com/macros/s/AKfycbz0XGeoEuP4V6W60N7yP-dDiLltPefxmqzhMJurnGzOhPfqA_er/ exec& continue = https://script.google.com/macros/s/AKfycbz0XGeoEuP4V6W60N7yP-dDiLltPefxmqzhMJurnGzOhPfqA_er/exec& passive = 1209600 

从script.google.com - https://script.google。 com / macros / s / AKfycbyCH4Jk7VcEIhE52jIorIBzcghRYAPRuwuzFSHwaWIB / dev

FROM browser - https://script.google.com/macros/s/AKfycbz0XGeoEuP4V6W60N7yP-dDiLltPefxmqzhMJurnGzOhPfqA_er/exec


解决案

终于找到了答案。



这是非常愚蠢的,但显然保存和重新发布您的谷歌脚本的Web应用程序是不够好。您需要保存一个新版本并发布新版本,以确保您的应用得到正确更新。


I'm getting a

Script function not found: doGet

OR

Script function not found: doPost

when I GET/POST to my Google script:

function doGet(e){return ContentService.createTextOutput("User says")}

function doPost(e) {
  return HtmlService.createHtmlOutput(
    "<form action='http://www.example.com/users/gmail_permission/' method='post' id='foo'>" + 
    "<input type='hidden' name='gmail' value='getEmail()' >" +
    "<input type='hidden' name='id' value='e.parameter.user_id' >" +    
    "</form>" +
    "<script>document.getElementById('foo').submit();</script>");
}

function getEmail() {
  return Session.getActiveUser().getEmail();
}

The weird thing is I'll get the above error when I visit the Webapp URL on my browser. But when I use Hurl.it, I just get redirected to Google Drive. But when I 'Test web app for your latest code.' on google.script.com, the GET response works fine.

Pretty lost as to what is going on.... here is my script:

 https://script.google.com/macros/s/AKfycbz0XGeoEuP4V6W60N7yP-dDiLltPefxmqzhMJurnGzOhPfqA_er/exec

Here are the GETs

 FROM Hurl.it - GET https://accounts.google.com/ServiceLogin?service=wise&followup=https://script.google.com/macros/s/AKfycbz0XGeoEuP4V6W60N7yP-dDiLltPefxmqzhMJurnGzOhPfqA_er/exec&continue=https://script.google.com/macros/s/AKfycbz0XGeoEuP4V6W60N7yP-dDiLltPefxmqzhMJurnGzOhPfqA_er/exec&passive=1209600

 FROM script.google.com - https://script.google.com/macros/s/AKfycbyCH4Jk7VcEIhE52jIorIBzcghRYAPRuwuzFSHwaWIB/dev

 FROM browser - https://script.google.com/macros/s/AKfycbz0XGeoEuP4V6W60N7yP-dDiLltPefxmqzhMJurnGzOhPfqA_er/exec

解决方案

Finally found the answer.

It's pretty stupid, but apparently saving and republishing your google script web app is not good enough. You need to save a new version and publish the new version to make sure your app gets updated properly.

这篇关于未找到Google Apps脚本功能:doGet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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